File tree Expand file tree Collapse file tree
Sprint-2/2-mandatory-debug Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,12 +13,30 @@ console.log(`The last digit of 42 is ${getLastDigit(42)}`);
1313console . log ( `The last digit of 105 is ${ getLastDigit ( 105 ) } ` ) ;
1414console . log ( `The last digit of 806 is ${ getLastDigit ( 806 ) } ` ) ;
1515
16+ // [ChunYanWong] No parameter included in the function and hence the same output
17+
1618// Now run the code and compare the output to your prediction
1719// =============> write the output here
20+
21+ // [ChunYanWong]
22+ //The last digit of 42 is 3
23+ //The last digit of 105 is 3
24+ //The last digit of 806 is 3
25+
1826// Explain why the output is the way it is
1927// =============> write your explanation here
28+
29+ // [ChunYanWong] No parameter included in the function
30+
2031// Finally, correct the code to fix the problem
2132// =============> write your new code here
33+ // [ChunYanWong] function getLastDigit(num) {
34+ // ...
2235
2336// This program should tell the user the last digit of each number.
2437// Explain why getLastDigit is not working properly - correct the problem
38+ // [ChunYanWong] for the case 12.34, it will return 4 instead of the digit 2
39+ // [ChunYanWong] function getLastDigit(num) {
40+ // return Math.abs(Math.trunc(num)) % 10;
41+ // }
42+
You can’t perform that action at this time.
0 commit comments