You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 063ef8d
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: Sprint-3/1-key-errors/1.js
+10-2Lines changed: 10 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
// Predict and explain first...
2
2
3
3
// Why will an error occur when this program runs?
4
-
// =============> write your prediction here
4
+
// because the decimanlNumber variable has already been declared and you cant declare it twice, also the parameter needs to not be tied to any value so it works as intended
5
5
6
6
// Try playing computer with the example to work out what is going on
7
7
@@ -15,6 +15,14 @@ function convertToPercentage(decimalNumber) {
15
15
console.log(decimalNumber);
16
16
17
17
// =============> write your explanation here
18
+
// decimalNumber creates a variable in the function scope, then const decimalNumber tries to create a variable with the same name in that same scope, then it hits a Syntax error. Then the program stops running
0 commit comments