Skip to content

Commit 534fc0c

Browse files
committed
Fix syntax errors and improve function implementations in various files
1 parent 4556717 commit 534fc0c

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

  • Sprint-3/1-key-errors

‎Sprint-3/1-key-errors/1.js‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
// Why will an error occur when this program runs?
44
// Answer below:
5-
// An error will occur for two reasons, first because there variable "decimalNumber" being decleared
6-
// The second reason is because the function "convertToPercentage" placeholder has no value when it was called
5+
// A syntax error will occur for two reasons, first because there variable const "decimalNumber" being redecleared
6+
// The second reason is because the function "convertToPercentage" is not called correctly.
77

88
// =============> write your prediction here:
99
// Answer below:
1010
// I predicted that the code will not work because of the variable (decimalNumber) inside the function,
11-
// Also because the console.log function is not not calling the function "convertToPercentage" with a value
11+
// Also because the console.log(decimalNumber) is just a name that exist inside the function
1212

1313

1414
// Try playing computer with the example to work out what is going on
@@ -22,6 +22,10 @@
2222
// console.log(decimalNumber);
2323

2424
// =============> write your explanation here
25+
// Answer:
26+
27+
// const decimalNumber redeclares the parameter name which causes a SyntaxError.
28+
// also console.log(decimalNumber) outside fails because the parameter only exists inside the function"
2529

2630
// Finally, correct the code to fix the problem
2731
// =============> write your new code here

0 commit comments

Comments
 (0)