Glasgow | 26-ITP-May | Christelle Boten | Sprint 1 | Coursework#1514
Glasgow | 26-ITP-May | Christelle Boten | Sprint 1 | Coursework#1514Christelle-b wants to merge 15 commits into
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
3 similar comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
|
||
| console.log(num); | ||
|
|
||
| // Here, Math.random creates a random number between 0 to 1 and Math.floor rounds down to the nearest integer. |
There was a problem hiding this comment.
Try breaking the expression down further and explain the rationale behind each part, especially why we use maximum - minimum + 1 and add minimum at the end. The goal is to explain the logic, not just the outcome.
| // Read the code and then answer the questions below | ||
|
|
||
| // a) How many function calls are there in this file? Write down all the lines where a function call is made | ||
| //There are two function calls here. replaceAll and console.log |
There was a problem hiding this comment.
There are more than 2 function calls here, please revisit the documentation/course to review function declarations.
There was a problem hiding this comment.
@Christelle-b One thing to keep in mind is that we're counting function calls, not unique functions. If a function is called multiple times, each invocation should be counted as a separate function call. Try reviewing the code with that in mind.
There was a problem hiding this comment.
@hey-hammad thank you for the clarification. There are 5 function calls. I have updated the notes on my code to show that. Number() function appears twice, same with replaceAll(). Then lastly we have console.log ().
| //Line 1, line 2, line 7 and line 8 have variable declarations | ||
|
|
||
| // e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression? | ||
| //This expression removes the comma in the price from 10,000 to 10000 |
There was a problem hiding this comment.
please mention the purpose of this expression as well.
| // The variable result shows the total remaining duration of a movie in terms of hours, minutes and seconds. We can also call it remainingTime. | ||
|
|
||
| // f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer | ||
| // The movieLength code will work work with all kinds of number. That is integers and floats. It will not work with strings No newline at end of file |
There was a problem hiding this comment.
try testing different edge cases and be more specific about what happens with different types of values (e.g. decimals, negative numbers, or unexpected inputs)
Self checklist
Changelist
I did all the the exercises requested.
Questions