Skip to content

Commit c63f763

Browse files
committed
key errors 0.2
1 parent d67f3f3 commit c63f763

File tree

1 file changed

+10
-6
lines changed
  • Sprint-2/1-key-errors

1 file changed

+10
-6
lines changed

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

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,22 @@
33

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

6-
// =============> write your prediction of the error here
6+
// =============> write your prediction of the error here: There will be an error because we put a value (3) as a function's parameter instead of using variable names. We also don't know where num comes from as we have't defined/ declared that.
77

8-
function square(3) {
9-
return num * num;
10-
}
8+
// function square(3) {
9+
// return num * num;
10+
// }
1111

12-
// =============> write the error message here
12+
// =============> write the error message here: SyntaxError: Unexpected number
1313

14-
// =============> explain this error message here
14+
// =============> explain this error message here: We get an error message saying that there is an unexpected number on line 8 (Syntax Error).
1515

1616
// Finally, correct the code to fix the problem
1717

1818
// =============> write your new code here
19+
function square(num) {
20+
return num * num;
21+
}
22+
console.log(square(3));
1923

2024

0 commit comments

Comments
 (0)