London | 26-ITP-May | Rhoda Ajiroba | Sprint 1 | Structuring and Testing Data - #1560
London | 26-ITP-May | Rhoda Ajiroba | Sprint 1 | Structuring and Testing Data#1560codebyra wants to merge 2 commits into
Conversation
This comment has been minimized.
This comment has been minimized.
3 similar comments
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.
|
@cjyuan, please, I would appreciate it if you could review my sprints for this module |
|
@LonMcGregor Please review this too |
| // num stores a random whole number between 1 and 100. | ||
| // Math.random() generates a random decimal between 0 and 1. | ||
| // Math.floor() rounds the number down to the nearest whole number. | ||
| // Adding minimum ensures the final result is between 1 and 100. |
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.
Could you rephrase the descriptions of the range?
Note: We could use the concise and precise interval notation to describe a range of values.
[,]=> inclusion(,)=> exclusion
For example, X is a number in [1, 10) means, X is a number between 1 and 10, including 1 but excluding 10.
| const cardNumber = 4533787178994213; | ||
| const cardNumber = "4533787178994213"; | ||
| const last4Digits = cardNumber.slice(-4); |
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.
| // Read the code and then answer the questions below | ||
|
|
||
| // a) How many function calls are there in this file? Write down all the lines where a function call is made | ||
|
|
||
| // 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? | ||
|
|
||
| // c) Identify all the lines that are variable reassignment statements | ||
|
|
||
| // d) Identify all the lines that are variable declarations | ||
|
|
||
| // e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression? |
There was a problem hiding this comment.
-
Could you also answer these questions?
-
In question (b), the error occurred because a comma was missing between the a___________s.
What is the programming term that belongs in the blank?
Learners, PR Template
Self checklist
Changelist
Completed the Sprint 1 mandatory exercises for the Structuring and Testing Data module.
Implemented the required solutions, tested the code to ensure it works correctly, and committed the changes following the sprint requirements.