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

NW6 | Nazanin_Saedi| Module-JS1 | WEEK4 #182

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

Conversation

nazaninsaedi
Copy link

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 .

Copy link

@Ara225 Ara225 left a 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.
Copy link

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.
*/
Copy link

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

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

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:
Copy link

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 :)

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