Skip to content

Commit 7dfcfcd

Browse files
committed
corrected the function parameter syntax
1 parent 38d9150 commit 7dfcfcd

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

  • Sprint-3/1-key-errors

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,25 @@
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+
// The will be no output printed on the console because there is no code to instructing printing.
8+
// The num variable is not defined and 3 is used instead of num
79

810
function square(3) {
911
return num * num;
1012
}
1113

1214
// =============> write the error message here
15+
SyntaxError: Unexpected number
1316

1417
// =============> explain this error message here
18+
// This error illustrates that a number was used instead of a variable name.
1519

1620
// Finally, correct the code to fix the problem
1721

1822
// =============> write your new code here
1923

20-
24+
function square(num) {
25+
squareNum = num * num;
26+
return squareNum;
27+
}
28+
console.log(square(3));

0 commit comments

Comments
 (0)