File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Sprint-2/2-mandatory-debug Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 33// Predict the output of the following code:
44// =============> Write your prediction here
55
6+ // It will convert 103 number into a String representation and then will either do no manipulations or invert the string
7+
68const num = 103 ;
79
8- function getLastDigit ( ) {
9- return num . toString ( ) . slice ( - 1 ) ;
10+ function getLastDigit ( digit ) {
11+ return digit . toString ( ) . slice ( - 1 ) ;
1012}
1113
1214console . log ( `The last digit of 42 is ${ getLastDigit ( 42 ) } ` ) ;
@@ -22,3 +24,7 @@ console.log(`The last digit of 806 is ${getLastDigit(806)}`);
2224
2325// This program should tell the user the last digit of each number.
2426// Explain why getLastDigit is not working properly - correct the problem
27+
28+ // The function getLastDigit() has no parameters and referenced a globally scoped constant `num`.
29+ // In order for it to `work properly`, a parameter is required and referencing it in order to
30+ // return an expected value
You can’t perform that action at this time.
0 commit comments