Skip to content

Commit 14ddfad

Browse files
committed
reverted changes to 2.js in sprint 2 file.
1 parent 8ad9d08 commit 14ddfad

File tree

1 file changed

+6
-10
lines changed
  • Sprint-2/1-key-errors

1 file changed

+6
-10
lines changed

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

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,19 @@
1+
12
// Predict and explain first BEFORE you run any code...
23

34
// this function should square any number but instead we're going to get an error
45

56
// =============> write your prediction of the error here
6-
//it will throw an error for use of a primitive value instead of a variable.
77

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

12-
// =============> write the error message here, SyntaxError: Unexpected number
12+
// =============> write the error message here
1313

1414
// =============> explain this error message here
15-
//this error message is becasue we cannot pass a direct value to a function when creating it but rather when we call it. Instead we need to give it a parameter that can then hold the value that we want to pass to the function.
15+
1616
// Finally, correct the code to fix the problem
1717

1818
// =============> write your new code here
19-
function square(num) {
20-
return num * num;
21-
}
2219

23-
console.log(square(3));

0 commit comments

Comments
 (0)