-
-
Notifications
You must be signed in to change notification settings - Fork 371
Expand file tree
/
Copy path2.js
More file actions
27 lines (19 loc) · 756 Bytes
/
Copy path2.js
File metadata and controls
27 lines (19 loc) · 756 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// 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
// num hasn't been defined, that will throw an error
/*
function square(3) {
return num3 * num3;
}
*/
// =============> write the error message here
// Uncaught SyntaxError: Unexpected number
// =============> explain this error message here
// the error appears in the line before, a function has to take defined parameters, these
// parameters cannot be represented by numbers (or at least begin with numbers)
// Finally, correct the code to fix the problem
// =============> write your new code here
function square(num) {
return num * num;
}