London | 26-ITP-May | Chun Yan Wong | Sprint 1 | CourseWork#1466
London | 26-ITP-May | Chun Yan Wong | Sprint 1 | CourseWork#1466cywong-dev wants to merge 14 commits into
Conversation
Added comment explaining the increment operation on the count variable.
Initialize dir and ext variables to extract directory and file extension from filePath.
[ChunYanWong] Added comment explaining num as a random integer.
Updated last4Digits assignment to correctly extract the last 4 digits of cardNumber.
Added comments to clarify variable declarations, function calls, and expressions related to movie length.
Added comments to explain the purpose of each step in the code.
Clarify the effects and return values of alert and prompt functions.
Added syntax help for console.log and console.
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.
| // https://www.google.com/search?q=get+first+character+of+string+mdn | ||
|
|
||
| // added by ChunYanWong for the solution | ||
| initials = firstName.substring(0,1) + middleName.substring(0,1) + lastName.substring(0,1); |
There was a problem hiding this comment.
There is a much shorter syntax to get the first character (or any character by its index) of a string.
|
|
||
| const dir = ; | ||
| const ext = ; | ||
| const dir = filePath.substring(0, url.lastIndexOf("/") + 1);; |
There was a problem hiding this comment.
-
What is
url? -
Should "dir" contain a trailing
/?
| // [ChunYanWong] The slice method extract substring starting with the first parameter position | ||
| // There is no -4 starting position and hence it will not work | ||
|
|
||
| const last4Digits = cardNumber.slice(cardNumber.length - 4) |
There was a problem hiding this comment.
Did you execute the code to ensure it works as expected?
| const twelveHourClockTime = "8:53pm"; | ||
| const twentyhourClockTime = "20:53"; |
There was a problem hiding this comment.
It's a not a good idea to have two almost identical variable names. Besides, the second name is not quite in "lower camel case" format. Could you rename the variable(s)?
| //[ChunYanWong] 3 . They are Number, replaceAll and console.log | ||
|
|
||
| // 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? | ||
| // [ChunYanWong] syntax error - add the comma to fix it. |
There was a problem hiding this comment.
We could more precisely describe "A comma is missing between "," and "" in the function call" as:
A comma is missing between the ___________s.
What is this programming term that refers to the values passed to a function? It begins with an 'a'.
| What is the return value of `prompt`? | ||
|
|
||
| [ChunYanWobg] Inputted name |
There was a problem hiding this comment.
What if a user enters a name and clicks "Cancel" instead of "OK"?
| What does the syntax `console.log` or `console.assert` mean? In particular, what does the `.` mean? | ||
|
|
||
| [ChunYanWong] The method of the object console or the functions of the object console |
There was a problem hiding this comment.
The last question had a second part. Could you also answer that?
Learners, PR Template
Self checklist
[X] I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
[X] My changes meet the requirements of the task
[X] I have tested my changes
[X] My changes follow the style guide
Changelist
Complete the coursework for sprint 1 in the module Structuring and testing data