This repository was archived by the owner on Apr 18, 2025. It is now read-only.
NW6 | Nazanin_Saedi| Module-JS1 | WEEK4#182
Open
nazaninsaedi wants to merge 6 commits intoCodeYourFuture:mainfrom
Open
NW6 | Nazanin_Saedi| Module-JS1 | WEEK4#182nazaninsaedi wants to merge 6 commits intoCodeYourFuture:mainfrom
nazaninsaedi wants to merge 6 commits intoCodeYourFuture:mainfrom
Conversation
Ara225
suggested changes
Dec 2, 2023
Ara225
left a comment
There was a problem hiding this comment.
Some bits undone - please keep plodding on - its all looking good
| // Additional logic to handle consecutive occurrences | ||
| // For example, if char is 'a' and str is 'aaaaa', | ||
| // we want to count this as one occurrence of 'a'. | ||
| // So, we can skip consecutive occurrences by incrementing i until a different character is encountered. |
There was a problem hiding this comment.
This works but is not what the question asked for I'm afraid - please read the instructions again and tweak it
| * Function to get the ordinal representation of a number. | ||
| * @param {number} n - The input number. | ||
| * @returns {string} - The ordinal representation of the input number. | ||
| */ |
| // If it is divisible, the function returns false, indicating that the number is not prime. | ||
|
|
||
| // Check for divisibility from 2 to the square root of the number | ||
| for (let i = 2; i <= Math.sqrt(num); i++) { |
There was a problem hiding this comment.
This works, but it is quite complicated - are you confident in your understanding?
| // Defines a function named isPasswordValid that takes a parameter password. | ||
| function isPasswordValid(password) { | ||
| // Step 1: Check if the password has at least 5 characters | ||
| if (password.length < 5) { |
| // When the repeat function is called with these inputs, | ||
| // Then it should throw an error or return an appropriate error message, as negative counts are not valid. | ||
|
|
||
| //Defines a function named repeat that takes two parameters, str and count: |
There was a problem hiding this comment.
This is a really well formatted and streamlined solution, I like it a lot :)
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
I try explain line by line . That way helps me understand each line and when I back to code I understand what I did .
please put review for me .