-
-
Notifications
You must be signed in to change notification settings - Fork 50
NW6 | Nazanin_Saedi| Module-JS1 | WEEK4 #182
base: main
Are you sure you want to change the base?
Conversation
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. | ||
*/ |
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.
Need to finish this
// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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) { |
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.
Looks good, need to impliment the rest
@@ -23,3 +23,44 @@ | |||
// Given a target string str and a negative integer count, | |||
// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a really well formatted and streamlined solution, I like it a lot :)
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 .