There was an error while loading. Please reload this page.
1 parent ef1ddd5 commit 5986205Copy full SHA for 5986205
1 file changed
Sprint-3/1-key-errors/2.js
@@ -4,17 +4,23 @@
4
// this function should square any number but instead we're going to get an error
5
6
// =============> write your prediction of the error here
7
+// The code in local scope could not refer to variable. function square should attach with a variable instead of value.
8
-function square(3) {
9
- return num * num;
10
-}
+//function square(3) {
+// return num * num;
11
+//}
12
13
// =============> write the error message here
14
+//SyntaxError: Unexpected number
15
16
// =============> explain this error message here
17
+// the error caused by the wrong input for the variable "square(3)".
18
19
// Finally, correct the code to fix the problem
20
21
// =============> write your new code here
22
+function square(num) {
23
+ return num * num;
24
+}
25
-
26
+console.log(square(3))
0 commit comments