London | 26-ITP-May | Dagim Daniel | Sprint 1 | 1-key-exercise -count #1375
Open
Dagim-Daniel wants to merge 4 commits into
Open
London | 26-ITP-May | Dagim Daniel | Sprint 1 | 1-key-exercise -count #1375Dagim-Daniel wants to merge 4 commits into
Dagim-Daniel wants to merge 4 commits into
Conversation
…reated a branch coursework/sprint-1.
…rest is done in this commit . i.e. 2 -initials done, 3-path done , 4 random is done.
cjyuan
reviewed
Jun 27, 2026
Comment on lines
+11
to
+18
| // breaking down the expression into smaller parts. | ||
| /* Math.floor(): this will return the largest integer less than or equal to a given number. In this case, it will round down the result of the expression inside the parentheses. | ||
| Math.random(): this will return a random floating-point number between 0 (inclusive) and 1 (exclusive). In this case, it will generate a random number between 0 and 1 but never exactly 1. | ||
| (maximum - minimum + 1): this will calculate the range of numbers we want to generate. In this case, it will calculate the difference between the maximum and minimum values (100 - 1 = 99) | ||
| and add 1 to include both endpoints (99 + 1 = 100). | ||
| finally, the code adds the minimum value (which is 1) to the result. | ||
| */ | ||
|
|
Contributor
There was a problem hiding this comment.
Note: To describe a range of numbers, we could use the concise and precise interval notation:
[,]=> inclusion(,)=> exclusion
For example, [1, 10) means, all numbers between 1 and 10, including 1 but excluding 10.
Comment on lines
+1
to
2
| const cardNumber = "4533787178994213"; | ||
| const last4Digits = cardNumber.slice(-4); |
Contributor
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.
Author
There was a problem hiding this comment.
i will use .toString() for conversion.
Contributor
If the questions are placed in the comments, yes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
… created a branch coursework/sprint-1.
Learners, PR Template
Self checklist
Changelist
i just created a branch coursework/sprint-1 and also answered 1-key exercise through multiple line comment.
Questions
we can answer some question through comment right?