-
-
Notifications
You must be signed in to change notification settings - Fork 301
LONDON-JAN-25 | ANDREI FILIPPOV | Module-Structuring-and-Testing-Data | WEEK 1 #276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
cjyuan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
I left you some comments and suggestions.
| let initials = `${firstName.charAt(0)}${middleName.charAt(0)}${lastName.charAt( | ||
| 0 | ||
| )}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why broke the template string literal into three lines?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think prettier did this. I also don't understand, why it broke it like this.
Sprint-1/1-key-exercises/3-paths.js
Outdated
| const dir = filePath.slice(1, lastSlashIndex); | ||
| const ext = filePath.slice(filePath.indexOf(".") + 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- The first
/is also part ofdir. - Can you refine the expression for extracting the file extension so that it will work also for file path like
"/Users/mitch/cyf.old/folder.bak/file.txt"?
Sprint-1/1-key-exercises/4-random.js
Outdated
|
|
||
| /* | ||
| In 1 step program calculates "(maximum - minimum + 1)", which evaluates to 100. This is the total range of numbers between 1 and 100 | ||
| In 2 step program multiples 100 by floating-point, pseudo-random number between 0 and 1. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The phrase "between 0 and 1" alone is not precise enough in program specification because
it does not state clearly whether 0 and 1 are included in the range.
You can look up Math.random() at MDN to find out exactly what value the function can return, ask ChatGPT how to concisely describe a range of numbers from 0 to 1 that include/exclude 0 and 1, and then use what you learn to describe the return value of Math.random().
Sprint-1/2-mandatory-errors/1.js
Outdated
| let age = 33; | ||
| age = age + 1; | ||
|
|
||
| // we cannot change consonant data type, so we need to change const to let |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is consonant data type?
Also, age is not a data type.
Sprint-1/2-mandatory-errors/2.js
Outdated
| console.log(`I was born in ${cityOfBirth}`); | ||
|
|
||
| /* | ||
| program couldn't find variable, because it was initialized after using, which is not correct |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"declared" or "initialized"? They mean different things in programming.
Sprint-1/2-mandatory-errors/4.js
Outdated
| const HourClockTime12 = "20:53"; | ||
| const hourClockTime24 = "08:53"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you also noticed the variable names do not quite match the values assigned to the variable?
Also, why started one of the variable names in uppercase and the other with a lowercase?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for pointing out, I haven't noticed it. Also I started one of the variable names in uppercase and the other with a lowercase because it was like this in the original code.
| // 3 | ||
| // carPrice = Number(carPrice.replaceAll(",", "")); | ||
| // priceAfterOneYear = Number(priceAfterOneYear.replaceAll("," "")); | ||
| // console.log(`The percentage change is ${percentageChange}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
foo(bar()) would be considered as two function calls in which bar() is called first and its return value is passed as a parameter to foo().
cjyuan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look great! Feel free to mark this PR as completed anytime.
| /* | ||
| In 1 step program calculates "(maximum - minimum + 1)", which evaluates to 100. This is the total range of numbers between 1 and 100 | ||
| In 2 step program multiples 100 by floating-point, pseudo-random number between 0 and 1. | ||
| In 2 step program multiples 100 by floating point, random number, that's greater than or equal to 0 and less than 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One concise way to specify a range of values is to use the interval notation.
For example, we can say, Math.random() returns a number in [0, 1).
Learners, PR Template
Self checklist
Changelist
Completed Sprint 1 Coursework
Questions
No questions