Skip to content
This repository was archived by the owner on Apr 18, 2025. It is now read-only.

NW6 | Pedram Amani | Module-JS1 | Week4 #191

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

pedram-am
Copy link

Learners, PR Template

Self checklist

  • [ ✓ ] I have committed my files one by one, on purpose, and for a reason
  • [ ✓ ] I have titled my PR with COHORT_NAME | FIRST_NAME LAST_NAME | REPO_NAME | WEEK
  • [ ✓ ] I have tested my changes
  • [ ✓ ] My changes follow the style guide
  • [ ✓ ] My changes meet the requirements of this task

Changelist

Briefly explain your PR.

JavaScript 1 - Week 4 exercises

Questions

Ask any questions you have for your reviewer.

Copy link
Contributor

@pseudopilot pseudopilot left a 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.

@@ -1,3 +1,47 @@
// Given a positive integer num,
// When the isPrime function is called with num as input,
// Then it should return a boolean representing whether the num is prime

function isPrime(num) {
if (isNaN(num) || num <= 0 || Number.isInteger(num) !== true) {
Copy link
Contributor

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) {
Copy link
Contributor

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

Comment on lines +40 to +43
let result = "";
for (let i = 0; i < count; i++) {
result += str;
}
Copy link
Contributor

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants