Skip to content

Commit 832b3db

Browse files
author
Pretty Taruvinga
committed
fixed syntacts errors
1 parent 6640d9e commit 832b3db

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

Sprint-2/1-key-errors/2.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
21
// Predict and explain first BEFORE you run any code...
32

43
// this function should square any number but instead we're going to get an error
54

65
// =============> write your prediction of the error here
76
// I predict that error will occur because the parameter 'num' is not defined in the function.
87

9-
function square(3) {
8+
// /* function square(3) {
109

11-
return num * num;
12-
}
10+
// return num * num;
11+
// } */
1312

1413
// =============> write the error message here
1514
// Uncaught SyntaxError: Unexpected number
@@ -23,6 +22,5 @@ function square(3) {
2322

2423
// =============> write your new code here
2524
function square(num) {
26-
return num * num;
25+
return num * num;
2726
}
28-

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);
1515
// Finally, correct the code to fix the problem
1616
// =============> write your new code here
1717
function multiply(a, b) {
18-
return a * b;
18+
return a * b;
19+
}

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ console.log(`The last digit of 806 is ${getLastDigit(806)}`);
2323
// Since 'num' is not changing based on the input, the function will always return the last digit of 103, which is 3, regardless of the input passed to the function. To fix this issue, we need to change the function to use the parameter 'number' instead of the variable 'num'.
2424
// Finally, correct the code to fix the problem
2525
// =============> write your new code here
26-
const num = 103;
2726

2827
function getLastDigit(number) {
2928
return number.toString().slice(-1);
@@ -36,4 +35,4 @@ console.log(`The last digit of 806 is ${getLastDigit(806)}`);
3635
// This program should tell the user the last digit of each number.
3736
// Explain why getLastDigit is not working properly - correct the problem
3837
// GetLastDigit seems not to work properly because the variable num is never passed into the function.
39-
// The fix is to call getLastDigit(num) so the function uses that value.
38+
// The fix is to call getLastDigit(num) so the function uses that value.

0 commit comments

Comments
 (0)