-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Hi Yousef,
Strings: Looks goods. Since your regular expression doesn't include letters you don't actually need the i flag. A simple /,/g would have been sufficient.
Arrays: The only comment I have is about your use of indexOf. This method returns the index of the item to search for (>= 0) or -1 if it is not found. It doesn't return a boolean. So I would change your code as follow:
if (indexOfItem === -1) {
console.log("The item you are looking for doesn't exist");
} else {
console.log('The item you are looking for is at index: ' + indexOfItem);
}Metadata
Metadata
Assignees
Labels
No labels