-
-
Notifications
You must be signed in to change notification settings - Fork 337
Expand file tree
/
Copy path2.js
More file actions
23 lines (14 loc) · 762 Bytes
/
2.js
File metadata and controls
23 lines (14 loc) · 762 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: the function is supposed to return the square of the number.
// this function should square any number but instead we're going to get an error
// =============> write your prediction of the error here: Maybe because we used a number instead of a variable inside the function declaration.
//function square(3) {
// return num * num;
// }
// =============> write the error message here : syntax error: Unexpected number (3)
// =============> explain this error message here: we shouldn't use a number as a parametre name of the function.
// Finally, correct the code to fix the problem
// =============> write your new code here
function square(num) {
return num*num;
}
console.log(square(3));