Skip to content

Commit 7502adf

Browse files
committed
fixing parameter name error
1 parent d0a3ed3 commit 7502adf

1 file changed

Lines changed: 15 additions & 6 deletions

File tree

  • Sprint-3/1-key-errors

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

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,29 @@
1-
21
// Predict and explain first BEFORE you run any code...
3-
2+
// i am guessing this function wants us to find the square root of 3 and whatever value we get we have to multiply it
43
// this function should square any number but instead we're going to get an error
54

65
// =============> write your prediction of the error here
76

8-
function square(3) {
9-
return num * num;
10-
}
7+
// function square(3) {
8+
// return num * num;
9+
// }
1110

1211
// =============> write the error message here
1312

13+
// function square(3) {
14+
// ^
15+
16+
// SyntaxError: Unexpected number
17+
1418
// =============> explain this error message here
19+
// we input a number as the parameter name, if we give the parameter a name it acts as a placeholder for the number we wish to give the function.
20+
// we then write our number in console.log so it can send a message back to function what number we would want to square.
1521

1622
// Finally, correct the code to fix the problem
1723

1824
// =============> write your new code here
1925

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

0 commit comments

Comments
 (0)