We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e307d6b commit 71fe9f0Copy full SHA for 71fe9f0
Sprint-2/debug/2.js
@@ -1,11 +1,24 @@
1
// Predict and explain first...
2
3
+/*
4
+we can not run this function because we settle the variable with const and this won't allow us to reassign
5
+the new value which we are trying to test in the console.log()
6
+
7
const num = 103;
8
9
function getLastDigit() {
10
return num.toString().slice(-1);
11
}
12
13
+*/
14
15
+//=========== This will work ==============
16
17
+function getLastDigit(num) {
18
+ return num.toString().slice(-1);
19
+}
20
21
22
console.log(`The last digit of 42 is ${getLastDigit(42)}`);
23
console.log(`The last digit of 105 is ${getLastDigit(105)}`);
24
console.log(`The last digit of 806 is ${getLastDigit(806)}`);
0 commit comments