Skip to content

Commit c5a6226

Browse files
committed
fix function square code error
1 parent a44bb25 commit c5a6226

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

  • Sprint-3/1-key-errors

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

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,27 @@
11

22
// Predict and explain first BEFORE you run any code...
3-
3+
44
// this function should square any number but instead we're going to get an error
5+
//we are giving a value for the input instead of name that can hold different values.
56

67
// =============> write your prediction of the error here
8+
//syntaxerror related to the function input "(3)"
79

8-
function square(3) {
9-
return num * num;
10-
}
10+
// function square(3) {
11+
// return num * num;
12+
// }
1113

1214
// =============> write the error message here
1315

1416
// =============> explain this error message here
15-
17+
// we gave a placeholder for the function instead of value that can't be changed.
1618
// Finally, correct the code to fix the problem
1719

1820
// =============> write your new code here
1921

2022

23+
function square(num) {
24+
return num * num;
25+
}
26+
27+
console.log(square(3));

0 commit comments

Comments
 (0)