Skip to content

Commit 712ef52

Browse files
committed
Add explanation for getLastDigit function issue and correction
1 parent 4eb2cc6 commit 712ef52

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

  • Sprint-3/2-mandatory-debug

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,8 @@ console.log(`The last digit of 806 is ${getLastDigit(806)}`);
4242

4343
// This program should tell the user the last digit of each number.
4444
// Explain why getLastDigit is not working properly - correct the problem
45+
46+
// Answer below:
47+
4548
// The global constant variable outside the function has affected the code and caused it to always reference the last number of the global variable
4649
// To fix this, the global variable will be removed from code and the function getLastDigit should take the variable name "num" assigned to the global variable.

0 commit comments

Comments
 (0)