Sheffield | 26-Jan-ITP| Mona-Eltantawy | Sprint 1 | Coursework/ Sprint1#1109
Sheffield | 26-Jan-ITP| Mona-Eltantawy | Sprint 1 | Coursework/ Sprint1#1109Mona-Eltantawy wants to merge 10 commits intoCodeYourFuture:mainfrom
Conversation
…oing. for File 1 in exercises.
…the const varible place to be before the console function line.
…need to changw the card number to string if we want to use .slice( ) function.
…variable name shoudn't start with a number.
| line 3 is updating the value of the count variable by adding 1 to its current value. | ||
| The = opperator is an assignment opperator that assigns the result of the expression on the right (count+1) to the varibale on the left (count). | ||
| so, if count was 0 befor line 3 is excuted it will be 1 after line 3 is excuted. | ||
| And if it was 1 it will be 2 after line 3 is excuted. No newline at end of file |
There was a problem hiding this comment.
Operation like count = count + 1 is very common in programming, and there is a programming term describing such operation.
Can you find out what one-word programming term describes the operation on line 3?
| // This should produce the string "CKJ", but you must not write the characters C, K, or J in the code of your solution. | ||
|
|
||
| let initials = ``; | ||
| let initials = (firstName[0] + middleName[0] + lastName[0]); |
There was a problem hiding this comment.
Why wrap the expression in a pair of parentheses? The syntax is still valid. It is just not a normal practice.
| const ext = filePath.slice (lastSlashIndex + 1); | ||
| console.log(`The ext part of ${filePath} is ${ext}`); |
There was a problem hiding this comment.
What is the expected value of ext (according to the illustration given on line 6-7)?
Does the code on line 23 output the expected value of "ext"?
| there are 4 function calls in this File, they are in the following lines: | ||
| line 1: carPrice.replaceAll(",", "") | ||
| line 2: priceAfterOneYear.replaceAll(",", "") | ||
| line 3: Number(carPrice.replaceAll(",", "")) | ||
| line 4: Number(priceAfterOneYear.replaceAll(",", "")) |
There was a problem hiding this comment.
There are more than 4 function calls.
| // e) What do you think the variable result represents? Can you think of a better name for this variable? | ||
| variable result represents the formatted remaining movielength time in hours, minutes, and seconds (HH:MM:SS). |
There was a problem hiding this comment.
Can you think of a better name for this variable?
| 5. const pence = paddedPenceNumberString | ||
| .substring(paddedPenceNumberString.length - 2) | ||
| .padEnd(2, "0"); | ||
| This line extracts the last two characters (representing pence) and ensures they are exactly two digits long by padding with trailing zeros if necessary, resulting in "99". |
There was a problem hiding this comment.
Could we expect this program to work as intended for any valid penceString if we deleted .padEnd(2, "0") from the code?
In other words, do we really need .padEnd(2, "0") in this script?
Learners, PR Template
Self checklist