File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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
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
You can’t perform that action at this time.
0 commit comments