London | 26-ITP-Jan | Xuanming Hu | Sprint 1 | Coursework #1015
London | 26-ITP-Jan | Xuanming Hu | Sprint 1 | Coursework #1015Samual-Hu wants to merge 4 commits intoCodeYourFuture:mainfrom
Conversation
Edu-Vin
left a comment
There was a problem hiding this comment.
The instructions for 2-mandatory-errors were not followed. Kindly recheck the files in this folder
| // Answer: There are 5 function calls in total. They are located on lines 4, 5, and 10. | ||
| // b) Run the code and identify the line where the error is coming from - why is this error occurring? How can you fix this problem? | ||
|
|
||
| // Answer: The error comes from line 5. It occurs because we are trying to reassign a value to `priceAfterOneYear`, which was originally declared as a `const`. To fix it, change `const` to `let` on line 2. |
There was a problem hiding this comment.
Thanks for catching that. I've added the missing error explanations to all 5 files and corrected the function call count. Let me know if it looks good now.
|
|
||
| // a) How many function calls are there in this file? Write down all the lines where a function call is made | ||
| // Answer: There are 5 function calls in total. They are located on lines 4, 5, and 10. | ||
| // Answer: There are 2 function calls in total. They are both `Number()` and are located on lines 4 and 5. |
There was a problem hiding this comment.
Your previous answer was correct. What I said was wrong was question b. Recheck your answer for question b
There was a problem hiding this comment.
Apologies for the confusion. I have corrected question b.
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
| // Answer: There are 5 function calls in total. They are located on lines 4, 5, and 10. | ||
| // b) Run the code and identify the line where the error is coming from - why is this error occurring? How can you fix this problem? | ||
| // Answer: The error comes from line 5. It occurs because we are trying to reassign a value to `priceAfterOneYear`, which was originally declared as a `const`. To fix it, change `const` to `let` on line 2. | ||
| // Answer: The error comes from line 4. Since JavaScript executes from top to bottom, it crashes on line 4 because we are trying to reassign a new value to `carPrice`, which was originally declared as a `const`. To fix it, change `const` to `let` on lines 1 and 2. |
There was a problem hiding this comment.
It was originally declared as let and not const. Your previous solution that states the error is from line 5 is correct. What was wrong was your reason. So check line 5 again to determine the reason for the error.
|
Your last commit returned the 1-key-errors and 2-mandatory-debug files to the original state removing your solution. |
Learners, PR Template
Self checklist
Changelist
slice,lastIndexOf) to extract file paths and extensions.constreassignment, execution order (Cannot access before initialization), incorrect data types, and invalid variable naming.substring,padStart,padEnd).Questions
None for now.