Skip to content

Commit 85bcc9b

Browse files
committed
Answering the task
1 parent e082897 commit 85bcc9b

File tree

1 file changed

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

1 file changed

+13
-6
lines changed

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

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,25 @@
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+
// =============> The num parameter should be mentioned inside the function square instead of the number 3.
7+
// then it should be called as square (3) in the console.log statement.
78

8-
function square(3) {
9-
return num * num;
10-
}
9+
//function square(3) {
10+
//return num * num;
11+
//}
12+
13+
// =============> function square(3) syntaxError: Unexpected number.
14+
// =============> 3 wasn't expected... instead a declaration like 'num' was expected.
1115

12-
// =============> write the error message here
1316

14-
// =============> explain this error message here
1517

1618
// Finally, correct the code to fix the problem
1719

1820
// =============> write your new code here
21+
function square(num) {
22+
return num * num;
23+
}
24+
25+
console.log(square(3));
1926

2027

0 commit comments

Comments
 (0)