-
-
Notifications
You must be signed in to change notification settings - Fork 50
NW6 | Pedram Amani | Module-JS1 | Week4 #191
base: main
Are you sure you want to change the base?
Conversation
pseudopilot
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.
This is really great job @pedram-am ! 🥇
I left few comments for you, but still it's done properly.
| // Then it should return a boolean representing whether the num is prime | ||
|
|
||
| function isPrime(num) { | ||
| if (isNaN(num) || num <= 0 || Number.isInteger(num) !== true) { |
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.
Just small refactoring is possible here: !Number.isInteger(num) instead of Number.isInteger(num) !== true
| throw new Error("The second parameter must be a number!"); | ||
| } | ||
|
|
||
| if (Number.isInteger(count) !== true || count < 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.
Same comment as above about Number.isInteger(num) !== true
| let result = ""; | ||
| for (let i = 0; i < count; i++) { | ||
| result += str; | ||
| } |
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.
This must work great! Though we may use string method repeat instead.
Learners, PR Template
Self checklist
Changelist
Briefly explain your PR.
JavaScript 1 - Week 4 exercises
Questions
Ask any questions you have for your reviewer.