Skip to content

Commit 6e2b1d7

Browse files
committed
Add fix code error
1 parent e198d25 commit 6e2b1d7

File tree

1 file changed

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

1 file changed

+10
-8
lines changed

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

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,19 @@
44
// this function should square any number but instead we're going to get an error
55

66
// =============> write your prediction of the error here
7-
8-
function square(3) {
9-
return num * num;
10-
}
7+
// It throw a error - because of invalid parameter (can't use a number as a parameter name)
8+
//function square(3) {
9+
// return num * num;
10+
//}
1111

1212
// =============> write the error message here
13-
13+
// SyntaxError: Unexpected number
1414
// =============> explain this error message here
15-
15+
// The "Unexpected number" error arises when a numeral is improperly positioned or used within JavaScript code.
1616
// Finally, correct the code to fix the problem
17-
1817
// =============> write your new code here
18+
function square(num){
19+
return num * num;
20+
}
1921

20-
22+
console.log(square);

0 commit comments

Comments
 (0)