Birmingham | 26-ITP-May | Tobias Amaechina | Sprint 1 | coursework#1369
Birmingham | 26-ITP-May | Tobias Amaechina | Sprint 1 | coursework#1369Tobias-Amaechina wants to merge 54 commits into
Conversation
…o I used let keyword to declare the variable
…r instead of string
… and it reads number, I have to comment out slice method line of code
… original code to see that error message says TypeError: cardNumber.slice is not a function
…e quotes around the numbers and printing last4Digits
…$ so the the first varible was name was updated to start with doller sign
| // 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.
Note: Usually the double quotes surrounding a string are not part of the sting value; they are only used to indicate the boundary of the string.
No change needed.
| @@ -1,9 +1,17 @@ | |||
| const cardNumber = 4533787178994213; | |||
| const cardNumber = "4533787178994213"; | |||
There was a problem hiding this comment.
Suppose you were not allowed to modify the statement const cardNumber = 4533787178994213;
(that is, keep the variable's value unchanged).
How would you modify the code (through type conversion) to still being able to use .slice(-4) to extract the last 4 digits from the given number.
There was a problem hiding this comment.
Used .toString() method to cast the number to string type
| const $12HourClockTime = "8:53pm"; | ||
| const _hourClockTime = "20:53"; No newline at end of file |
There was a problem hiding this comment.
Identifiers that begin with _ or $ are valid variable names. However, they are usually used by convention to signal special meaning.
Could you explore names that start with alphabets instead? Feel free to ask AI for suggestion.
There was a problem hiding this comment.
Used best practices to rename the variable as recommended in JavaScript
| // 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? | ||
|
|
||
| // 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? | ||
| // The error is occurring on line 5., and it's a SyntaxError: missing , The error is due to a missing comma in the replaceAll() method. The correct syntax should be replaceAll(",", ""). To fix this problem, we need to add the missing comma in the replaceAll() method on line 5 |
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.
Could you look up the programming term that belongs in the blank?
There was a problem hiding this comment.
I have giveb the right terminology to the variable in the blank function call
|
All issus raised has been resolved |
|
The changed files in this PR don't match what is expected for this task. Please check that you committed the right files for the task, and that there are no accidentally committed files from other sprints. Please review the changed files tab at the top of the page, we are only expecting changes in this directory: If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed). If this PR needs reviewed, please add the 'Needs Review' label to this PR after you have resolved the issues listed above. |
|
All issues raised has been addressed |
|
The changed files in this PR don't match what is expected for this task. Please check that you committed the right files for the task, and that there are no accidentally committed files from other sprints. Please review the changed files tab at the top of the page, we are only expecting changes in this directory: If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed). If this PR needs reviewed, please add the 'Needs Review' label to this PR after you have resolved the issues listed above. |
|
The changed files in this PR don't match what is expected for this task. Please check that you committed the right files for the task, and that there are no accidentally committed files from other sprints. Please review the changed files tab at the top of the page, we are only expecting changes in this directory: If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed). If this PR needs reviewed, please add the 'Needs Review' label to this PR after you have resolved the issues listed above. |
|
Deleted files are also considered "changes". Here's one way to fix the problem. Reverting ChangesOne way to revert changes to a file is via the First, locate a commit before the file was modified. It could be the first commit you made, assuming the branch started in a clean state. Next, record the first 7 characters of the commit SHA. Suppose the file is In your case, After the file is restored, make a commit and push the changes to GitHub. |
|
Your PR couldn't be matched to an assignment in this module. Please check its title is in the correct format, and that you only have one PR per assignment. If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed). If this PR needs reviewed, please add the 'Needs Review' label to this PR after you have resolved the issues listed above. |
|
Did you restore the file content by copying-pasting the code? Different editors on different operating systems may format the last line differently. The safest way to restore the files are either through |
… value a number data type
…value to cardNumberString
6615f0e to
a96b47e
Compare
|
Your PR couldn't be matched to an assignment in this module. Please check its title is in the correct format, and that you only have one PR per assignment. If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed). If this PR needs reviewed, please add the 'Needs Review' label to this PR after you have resolved the issues listed above. |
Learners, PR Template
Self checklist
Changelist
This is PR for coursework Solutions for Sprin-1 of the "Module-Structuring- and Testing-Data Module, it covers key exercises on JavaScript fundamentals (variable assignments, string manipulations , String methods ,random numbers , and mandatory error fixing activities along with interpretation exercises that test understanding of code behaviour and syntax .
1-key-exercises/ — 4 files with solutions for count, initials, paths, and random number generation
2-mandatory-errors/ — 5 files fixing syntax/logic errors (comments, variable scope, type issues, naming)
3-mandatory-interpret/ — 3 files with detailed explanations of code behavior
4-stretch-explore/ — 2 files exploring browser APIs and object concepts