Skip to content

Commit 58865b6

Browse files
author
kohanman
committed
Sprint 2 | Coursework 1.2
1 parent 9aef627 commit 58865b6

File tree

1 file changed

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

1 file changed

+10
-5
lines changed

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

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
1-
21
// Predict and explain first BEFORE you run any code...
32

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

65
// =============> write your prediction of the error here
6+
//going to give an identifier expected error because the 3 should be num
77

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

1212
// =============> write the error message here
13+
//SyntaxError: Unexpected number
1314

1415
// =============> explain this error message here
16+
// function doesnt have an object to call if there is a number here
1517

1618
// Finally, correct the code to fix the problem
1719

1820
// =============> write your new code here
1921

20-
22+
function square(num) {
23+
return num * num;
24+
}
25+
console.log(square(3));

0 commit comments

Comments
 (0)