You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit edec231
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: Sprint-3/2-mandatory-debug/2.js
+4-2Lines changed: 4 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -14,9 +14,11 @@ console.log(`The last digit of 105 is ${getLastDigit(105)}`);
14
14
console.log(`The last digit of 806 is ${getLastDigit(806)}`);
15
15
16
16
// 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
18
20
// 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.
0 commit comments