Skip to content

Commit c1c09a6

Browse files
update comments to clarify expected output and explanation in getLastDigit function
1 parent 071cf21 commit c1c09a6

File tree

1 file changed

+8
-0
lines changed
  • Sprint-2/2-mandatory-debug

1 file changed

+8
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
// Predict the output of the following code:
44
// =============> Write your prediction here
5+
// I expect each of the calls to return the last digit of "num" which is "3" its defined as a constant and we are using that const in the return statement.
56

67
const num = 103;
78

@@ -15,8 +16,15 @@ console.log(`The last digit of 806 is ${getLastDigit(806)}`);
1516

1617
// Now run the code and compare the output to your prediction
1718
// =============> write the output here
19+
// Output:
20+
// The last digit of 42 is 3
21+
// The last digit of 105 is 3
22+
// The last digit of 806 is 3
23+
1824
// Explain why the output is the way it is
1925
// =============> write your explanation here
26+
// The output is the same for all three calls because the function getLastDigit does not take any parameters. It always uses the constant "num" which is defined as 103, and will always returns the last digit of 103, which is "3".
27+
2028
// Finally, correct the code to fix the problem
2129
// =============> write your new code here
2230

0 commit comments

Comments
 (0)