London | 26-ITP-May | Mandip sanger | Sprint 1 | Coursework#1516
London | 26-ITP-May | Mandip sanger | Sprint 1 | Coursework#1516mandipsanger wants to merge 16 commits into
Conversation
| @@ -1,9 +1,12 @@ | |||
| const cardNumber = 4533787178994213; | |||
| const cardNumber = "4533787178994213"; | |||
There was a problem hiding this comment.
Suppose you're not allowed to modify the original value. How would you achieve this using code alone?
| const 12HourClockTime = "8:53pm"; | ||
| const 24hourClockTime = "20:53"; | ||
|
|
||
| // 12 Hour clock time is a string that represents the time in 12-hour format, while 24hourClockTime is a string that represents the time in 24-hour format. |
There was a problem hiding this comment.
please review this code again, you need to fix the error in the file.
| const result = `${totalHours}:${remainingMinutes}:${remainingSeconds}`; | ||
| console.log(result); | ||
| // There are 6 variables declared in this program: movieLength, remainingSeconds, totalMinutes, remainingMinutes, totalHours, and result. | ||
| // There are 4 function calls in this program: console.log(), and the three arithmetic operations used to calculate remainingSeconds, totalMinutes, and remainingMinutes. |
There was a problem hiding this comment.
please review this answer again, and double-check what counts as a function call in JavaScript
There was a problem hiding this comment.
count is how many time fuction been called. In this case its result been called only once.
| // Interpret line 4, the expression assigned to totalMinutes calculates the total number of minutes in the movie by subtracting the remaining seconds from the total length of the movie and dividing by 60. | ||
| // The variable result represents the formatted string of the movie length in hours, minutes, and seconds. A better name for this variable could be formattedMovieLength or movieLengthString. | ||
| // This code will work for all values of movieLength, as it correctly calculates the hours, minutes, and seconds regardless of the total length of the movie. However, if movieLength is negative, it may not produce a meaningful result. | ||
| // experimenting with different values of movieLength, such as 2:25.833, 1:23:20, will show that the code correctly formats the length of the movie in hours, minutes, and seconds for all positive values. |
There was a problem hiding this comment.
try testing a wider range of values and consider whether there are any inputs that produce unexpected output or formatting.
There was a problem hiding this comment.
the range is only allowed in seconds
|
|
||
| // To begin, we can start with | ||
| // 1. const penceString = "399p": initialises a string variable with the value "399p" | ||
| // const penceString = "399p": initialises a string variable with the value "399p" |
There was a problem hiding this comment.
Good start, but please play around with the code and try explaining the rationale behind each step. For example, why is padding needed here?
There was a problem hiding this comment.
Thank you I will look into these again
There was a problem hiding this comment.
Padding is used to make sure the number has the correct number of digits before it is split into pounds and pence.padStart(3, "0") adds zeros to the beginning of the string until it is at least 3 characters long.
Learners, PR Template
Self checklist
Changelist
added tasks from sprint1