-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2.js
More file actions
24 lines (13 loc) · 832 Bytes
/
2.js
File metadata and controls
24 lines (13 loc) · 832 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Predict and explain first BEFORE you run any code...
// this function should square any number but instead we're going to get an error
// =============> write your prediction of the error here: the error might be inside the function "the square number" or might be num is not identified.//
function square(3) {
return num * num;
}
// =============> write the error message here: Uncaught syntaxError: Unexpected number.//
// =============> explain this error message here: This error occurs because the function parameter is not defined correctly. Instead of passing a number directly, we should use a variable name. In this case, we can use "num" as the parameter name.
// Finally, correct the code to fix the problem
// =============> write your new code here
// function square(num) {
// return num * num;
// }