Skip to content

Commit 4c2400a

Browse files
committed
Fix error 2
1 parent 063ef8d commit 4c2400a

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

  • Sprint-3/1-key-errors

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,20 @@
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+
// =============> Because the parameter needs to possess a name, i believe this will throw an error
77

88
function square(3) {
99
return num * num;
1010
}
1111

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

14-
// =============> explain this error message here
14+
// =============> Because a parameter is a placeholder name for the function, it should receive a value when the function is called, it cant be a number.
1515

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

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

0 commit comments

Comments
 (0)