Skip to content

Commit a128bbf

Browse files
committed
Fix square function parameter
1 parent 7cd8ae3 commit a128bbf

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

  • Sprint-3/1-key-errors

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,23 @@
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+
// =============> write your prediction of the error here:We will have a SyntaxError because we need a valid function parameter.
77

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

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

14-
// =============> explain this error message here
14+
// =============> explain this error message here:function square(3) {
15+
//3 is a number, not a valid variable. Program expects a parameter name there.
1516

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

18-
// =============> write your new code here
19+
// =============> write your new code here:
20+
function square(num) {
21+
return num * num;
22+
}
1923

24+
console.log(square(3));
2025

0 commit comments

Comments
 (0)