London | 26-ITP-Jan | Boualem Larbi Djebbour | sprint 1 | Coursework#1090
London | 26-ITP-Jan | Boualem Larbi Djebbour | sprint 1 | Coursework#1090djebsoft wants to merge 30 commits intoCodeYourFuture:mainfrom
Conversation
Updated comment to clarify the assignment operation.
Updated the initials variable to dynamically generate initials from first, middle, and last names.
Implemented logic to extract directory and extension from filePath.
Added comments to explain the purpose and behavior of the num variable and the random number generation process.
Changed 'const' to 'let' for age variable to allow reassignment.
Fix variable declaration order to avoid reference error.
Updated last4Digits assignment to convert cardNumber to a string before slicing.
Updated variable names to avoid starting with digits.
Fixed syntax error in priceAfterOneYear assignment and updated comments.
Added comments to explain the purpose of each step in the code.
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.
Updated the capitalise function to fix variable redeclaration and corrected the return variable name.
Declare 'result' with 'let' to avoid redeclaration error.
…ge function Removed duplicate declaration of decimalNumber and updated comments.
Corrected the square function to properly accept a parameter and return its square.
Refactored multiply function to include return statement and improved logging.
Fix the sum function to correctly return the sum of two numbers.
Corrected the getLastDigit function to accept a parameter and return the last digit of a number.
Added a function to convert a string to upper snake case.
Updated comments in time-format.js to clarify the behavior of the pad function.
Removed comments with answers to questions about the pad function.
Refactor toPounds function for reusability and clarity.
Removed the upperSnakeCase function implementation and example call.
Fix the sum function to return the correct result.
Corrected the square function to properly accept a parameter and return its square.
Updated comments to clarify errors and provide explanations.
Removed duplicate variable declaration and fixed typo in return statement.
cjyuan
left a comment
There was a problem hiding this comment.
I noticed some inconsistency in the formatting of the code.
Consider install prettier VSCode extension and enable formatting on save/paste on VSCode as recommended in
https://github.com/CodeYourFuture/Module-Structuring-and-Testing-Data/blob/main/readme.md
|
|
||
| const dir = ; | ||
| const ext = ; | ||
| const dir = filePath.slice(0,lastSlashIndex+1); |
There was a problem hiding this comment.
Do you intend to include a trailing / in the value assigned to dir?
| const lastPointIndex = filePath.lastIndexOf("."); | ||
| const ext = filePath.slice(lastPointIndex+1); |
There was a problem hiding this comment.
This approach is better because it works for extensions of any length.
| // the num represents a value with limited interval and that's why | ||
| // the num assigned to a value that's in the dor of an expression | ||
| // the math object is invoked to perform some mathematical tasks | ||
| // the random method is invoked to get a random number between 0 and 1 | ||
| // the random number is multiplied by 100 | ||
| // the floor method is invoked to round down the result to its nearest integer | ||
| // added one to the new result | ||
| // the final result of the whole expression is what the variable num assigned to | ||
| /* after applying the program several times, I got the idea that the program is generating | ||
| a value to the num variable thats always between minimum an maximum*/ |
There was a problem hiding this comment.
Phrases like "a number between X and Y" are not precise enough in a program specification, because they do not clearly state whether the endpoints X and Y are included.
We can also use the concise and precise interval notation to describe a range of values.
[,]=> inclusion(,)=> exclusion
For example, [1, 10) means, all numbers between 1 and 10, including 1 but excluding 10.
| @@ -1,9 +1,18 @@ | |||
| const cardNumber = 4533787178994213; | |||
| const last4Digits = cardNumber.slice(-4); | |||
| const last4Digits = (cardNumber.toString()).slice(-4); | |||
There was a problem hiding this comment.
Dot operator is evaluated from left to right. So the parentheses around cardNumber.toString() is optional, and is usually omitted.
| const $12HourClockTime = "20:53"; // or any change that makes the identifier not stating with digit | ||
| const _24hourClockTime = "08:53"; // identifier can not begin with a number | ||
| // or | ||
| const $24hourClockTime = "08:53"; // or any change that makes the identifier not stating with digit |
There was a problem hiding this comment.
Starting a variable name with a $ is generally not recommended.
Normal practice is to begin a variable name with a lowercase letter.
|
|
||
| // e) What do you think the variable result represents? Can you think of a better name for this variable? | ||
| // it represents the length of the movie in hours, minutes and seconds format | ||
| // a better name would be: movieTimeVolume |
There was a problem hiding this comment.
The name movieTimeVolume does not quite indicate the value stored in the variable
is a formatted string in the form "2:12:02".
Can you suggest a more descriptive name?
| // line 3: calling substring method to remove the 'p' letter and keep only digits in the string | ||
| // line 8: using padstart method to make the minimum length of the string to 3 characters by adding one zero or two to the left. | ||
| // line 9: using substring method to take only the integer part | ||
| // line 14: using substring method to take only the decimal part and padend method to make the minimum length of pence to 2 characters by adding zero to the right |
There was a problem hiding this comment.
Optional challenge:
Could we expect this program to work as intended for any valid penceString if we deleted .padEnd(2, "0") from the code?
In other words, do we really need .padEnd(2, "0") in this script?
There was a problem hiding this comment.
There should not be modified files in the Sprint-2 folder in a PR created for Sprint-1 exercise.
Can you revert (undo) the changes made in the Sprint-2 folder?
|
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. |
1 similar comment
|
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. |
Learners, PR Template
Self checklist
Changelist
I completed the mandatory sections of sprint 1 for the second module
Questions