Skip to content

Commit 03d224d

Browse files
committed
fix parameter name in sprint 3 key error 2
1 parent 6d602d8 commit 03d224d

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

  • Sprint-3/1-key-errors

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,19 @@
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+
// Prediction: there is going to be an error because there is a number in the parameter
77

8-
function square(3) {
8+
function square(num) {
99
return num * num;
1010
}
11+
console.log(square(5));
12+
// it showed SyntaxError: Unexpected number
1113

12-
// =============> write the error message here
13-
14-
// =============> explain this error message here
14+
// the parameter of a function must be a name /identifier, not a number.
15+
// JavaScript expected a word as a parameter but fond a number instead hence the SyntaxError.
1516

1617
// Finally, correct the code to fix the problem
1718

18-
// =============> write your new code here
19+
// New code : replaced the parameter with a valid identifier
1920

2021

0 commit comments

Comments
 (0)