Conversation
✅ Deploy Preview for cyf-onboarding-module ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
| // This should produce the string "CKJ", but you must not write the characters C, K, or J in the code of your solution. | ||
|
|
||
| const initials = ``; | ||
| const initials = firstName.charAt(0) + middleName.charAt(0) + lastName.charAt(0) |
There was a problem hiding this comment.
Add a semicolon at the end of this line
There was a problem hiding this comment.
Thank you, added a semicolon at the end.
| //num represents a randomly generated whole number between 1 and 100. | ||
|
|
||
| // Try breaking down the expression and using documentation to explain what it means | ||
| // Math.random() generates a random decimal number greater than or equal to 0 and less than 1. Multiplying it by 100 gives a number between 0 and 100. |
There was a problem hiding this comment.
Gives a number between 0 and up to, but not including 100.
Thank you
| // Math.random() generates a random decimal number greater than or equal to 0 and less than 1. Multiplying it by 100 gives a number between 0 and 100. | ||
| // Math.floor() always rounds down and returns the largest integer less than or equal to a given number in this case between 0 and 99. Finally, adding 1 changes the range to 1–100. | ||
| // Math.floor(Math.random() * (maximum - minimum + 1)) | ||
| // Math.floor(Math.random() * (100 - 1 + 1) |
There was a problem hiding this comment.
A closing bracket is missing in this line
There was a problem hiding this comment.
Added the missing closing bracket.
Thank you
| const age = 33; | ||
| age = age + 1; | ||
|
|
||
| let age = 33; |
There was a problem hiding this comment.
This file does not run, check age declaration
| @@ -1,9 +1,15 @@ | |||
| const cardNumber = 4533787178994213; | |||
There was a problem hiding this comment.
This file does not run. Check cardNumber and last4Digits declaration
| @@ -1,2 +1,5 @@ | |||
| const 12HourClockTime = "8:53pm"; | |||
There was a problem hiding this comment.
This file does not run. Check variable declaration
abdishakoor-dev
left a comment
There was a problem hiding this comment.
Thanks for the quick turnaround, all six of the earlier comments are sorted.
Three files still stop with an error when you run them, and two of them stop for the same reason.
Before I can mark this Complete:
-
2-mandatory-errors/0.js, see my comment. -
3-mandatory-interpret/1-percentage-change.jsand3-to-pounds.jsboth stop with an error. See my comment on each. -
3-mandatory-interpret/1-percentage-change.jsanswer a), see my comment. -
2-mandatory-errors/1.jsand4.js: the fixes are right, but this section also asks you to explain the error, and there is nothing written down for either. You did that well in2.jsand3.js, so the same again. -
Could you run Prettier over the
Sprint-2folder? Most of the files are not formatted at the moment.
Add the Needs Review label again when you have pushed.
| @@ -1,2 +1,5 @@ | |||
| This is just an instruction for the first activity - but it is just for human consumption | |||
There was a problem hiding this comment.
You have added the two lines as comments below, which is the right idea. But lines 1 and 2 are still here as they were, so node still reads them as JavaScript and stops. What needs to happen to these two lines?
There was a problem hiding this comment.
That is it, thanks.
|
|
||
| // a) How many function calls are there in this file? Write down all the lines where a function call is made | ||
|
|
||
| 4 function calls |
There was a problem hiding this comment.
Your answers from here down are written as code rather than as comments, so node tries to run them and stops. Compare this file with 2-time-format.js, where you put // in front of every answer. That is the way to do it.
On a) itself: you have found four calls. Look at line 10 as well. What is console.log(...) doing there?
There was a problem hiding this comment.
I missed that. I’ve corrected it to five calls. Thanks for pointing it out.
There was a problem hiding this comment.
Five is right, and console.log is the one people miss.
| // To begin, we can start with | ||
| // 1. const penceString = "399p": initialises a string variable with the value "399p" | ||
|
|
||
| 1. const penceString = "399p" // Stores "399p" in a variable called penceString so the program can work with the price. |
There was a problem hiding this comment.
Same thing here. Your breakdown from this line down is written as code, so the file stops with an error. The content of the six steps is right, they just need to be comments.
There was a problem hiding this comment.
Understood. I’ve corrected the six steps and converted them to comments.
There was a problem hiding this comment.
Good, the file runs now.
| //const age = 33; | ||
| //age = age + 1; | ||
|
|
||
| let age = 33; |
There was a problem hiding this comment.
The fix is right and the file runs now. This section also asks you to interpret the error and explain why it happened, and there is nothing written down here yet. What did node print before you changed it, and why?
There was a problem hiding this comment.
I didn’t see the section asking me to explain the error, so perhaps I’m looking in the wrong place.
Node returned TypeError: Assignment to constant variable because const cannot be reassigned, so I used let instead. My apologies if I’ve misunderstood the task.
There was a problem hiding this comment.
You were not looking in the wrong place. This file does not ask for it anywhere, only the section heading in the Sprint-2 README does. No apology needed. Your explanation here is right, so that is done.
| //const 12HourClockTime = "8:53pm"; | ||
| //const 24hourClockTime = "20:53"; | ||
|
|
||
| const ClockTime12Hour = "8:53pm"; |
There was a problem hiding this comment.
The renaming is right and the file runs. Same as 1.js though, there is no explanation of the error. What did node say before, and what was wrong with the original two names?
There was a problem hiding this comment.
Node returned SyntaxError: Invalid or unexpected token. Both variable names started with a number, which JavaScript does not allow.
Again, I might be looking in the wrong place or have misunderstood the task.
There was a problem hiding this comment.
Same here, and your explanation is correct. Nothing else needed on this one.
|
I’ve run Prettier over the Sprint-2 folder and formatted the files. Thanks for letting me know about Prettier—I wasn’t familiar with it before. |
abdishakoor-dev
left a comment
There was a problem hiding this comment.
Everything is sorted. All twelve files run, the answers are all there, and Prettier is clean.
On the two files where you asked whether you were looking in the wrong place: you were not. Neither file asks for an explanation anywhere in it. It is only mentioned in the heading of section 2 in the Sprint-2 README, which is easy to miss. Both of your explanations are right, so that is fine.
Marking this Complete.

Self checklist
Task code
CYF-1039
Changelist
Completed JavaScript fundamental tasks covering variables, assignment operators, strings, numbers, calculations, random numbers, time conversions, and objects. Also completed Chrome Console exercises.