London | 26-ITP-January | Khaliun Baatarkhuu | Sprint 1 | Coursework. #1030
London | 26-ITP-January | Khaliun Baatarkhuu | Sprint 1 | Coursework. #1030khaliun-dev wants to merge 14 commits intoCodeYourFuture:mainfrom
Conversation
Corrected the increment operation for the count variable.
…d assigned them as "CKJ".
…clared first then used.
Changed cardNumber to a string before slicing to get last 4 digits.
Updated variable names to follow JavaScript naming conventions.
Fixed syntax error by adding a missing comma in replaceAll function calls.
…lize the reasoning behind the code.
Clarify the effects and return values of alert and prompt functions.
Added explanations about the console object and its methods.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| 3. If I enter my name undefined appears, same if i press the cancel button. Fixed this by adding myName at the end. | ||
| Now the value when i enter my name shows "my name", if i press cancel it shows "null". |
There was a problem hiding this comment.
What you observed were the output produced by console.log()
When a value is output on the console, it is converted to a string first. As such, just by looking at the output, we could not tell the actual type of the value being returned by the function. For examples, in both of the following actions, console.log() would output "null" on the screen.
- A user entered "null" in the dialog box and then clicked "OK.
- A user entered nothing in the dialog box and then clicked "Cancel"
Can you look up the Window.prompt() function at MDN Web Docs and find out what this function returns?
There was a problem hiding this comment.
Window.prompt() returns a string containing the text entered by the user, or null.
There was a problem hiding this comment.
@cjyuan Good morning,
Thank you for your hard work reviewing everything and your feedback. I think, i have completed and understood all the points you have raised.
Could you have another look, please?
Khaliun
|
All responses are spot on. Well done. |
Self checklist
Changelist
Debugged errors, explained some of the answers i have provided with reasoning, and implemented functions.
Questions
None at the moment.