Skip to content

Commit 451364c

Browse files
Correct the changes and effect changes.
1 parent 9515acb commit 451364c

File tree

1 file changed

+10
-10
lines changed
  • Sprint-2/2-mandatory-debug

1 file changed

+10
-10
lines changed

Sprint-2/2-mandatory-debug/2.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
// Predict and explain first...
22

3-
// Predict the output of the following code:
4-
// =============> Write your prediction here
3+
// IPredict the output of the following code:
4+
// I am predicting an error because the variable const num = 103 is outside the function. =============> Write your prediction here
5+
// There is no parameters in the function condition
56

6-
const num = 103;
77

8-
function getLastDigit() {
8+
9+
// Now run the code and compare the output to your prediction
10+
// when i ran the output i got 3,3,3.=============> write the output here
11+
// Explain why the output is the way it is
12+
// the argument for the console.log is ignored because "getlastDigit" does not have a parameter. =============> write your explanation here
13+
// Finally, correct the code to fix the problem
14+
function getLastDigit(num) {
915
return num.toString().slice(-1);
1016
}
1117

1218
console.log(`The last digit of 42 is ${getLastDigit(42)}`);
1319
console.log(`The last digit of 105 is ${getLastDigit(105)}`);
1420
console.log(`The last digit of 806 is ${getLastDigit(806)}`);
15-
16-
// Now run the code and compare the output to your prediction
17-
// =============> write the output here
18-
// Explain why the output is the way it is
19-
// =============> write your explanation here
20-
// Finally, correct the code to fix the problem
2121
// =============> write your new code here
2222

2323
// This program should tell the user the last digit of each number.

0 commit comments

Comments
 (0)