Skip to content

Commit edec231

Browse files
committed
printed and explained log output
1 parent 9863ef0 commit edec231

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

  • Sprint-3/2-mandatory-debug

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ console.log(`The last digit of 105 is ${getLastDigit(105)}`);
1414
console.log(`The last digit of 806 is ${getLastDigit(806)}`);
1515

1616
// Now run the code and compare the output to your prediction
17-
// =============> write the output here
17+
// output: The last digit of 42 is 3
18+
//The last digit of 105 is 3
19+
//The last digit of 806 is 3
1820
// Explain why the output is the way it is
19-
// =============> write your explanation here
21+
// the console output prints this because the the methods have only been applied to the number stored in the num variable so javascript isn't able to access the numbers passed in when the function is called in the template literal as the function getLastDigit() has no parameter so it passes in the value stored in the num variable which is "3" and so every time the function is called "3" is returned.
2022
// Finally, correct the code to fix the problem
2123
// =============> write your new code here
2224

0 commit comments

Comments
 (0)