Skip to content

Commit f342a4c

Browse files
committed
Completed 2.js exercise
1 parent 1028541 commit f342a4c

File tree

1 file changed

+11
-1
lines changed
  • Sprint-2/1-key-errors

1 file changed

+11
-1
lines changed

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,26 @@
55

66
// =============> write your prediction of the error here
77

8+
// The function will not execute because of the undefined variable `num` and the parameter `3`,
9+
// which is not allowed to be defined with just numbers. There must be letters to define a variable
10+
// but can begins with numbers.
11+
812
function square(3) {
913
return num * num;
1014
}
1115

1216
// =============> write the error message here
1317

18+
// SyntaxError: Unexpected number
19+
1420
// =============> explain this error message here
1521

22+
// It's referring to the function parameter `3`
23+
1624
// Finally, correct the code to fix the problem
1725

1826
// =============> write your new code here
1927

20-
28+
function squared(value) {
29+
return value * value;
30+
}

0 commit comments

Comments
 (0)