-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pr 5 #5
base: master
Are you sure you want to change the base?
Pr 5 #5
Conversation
return isAllUnique; | ||
}; | ||
|
||
export default isAllUniqueElements; |
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.
Is this line necessary? From the code I see here, I can't tell why it is needed.
let isAllUnique = true; | ||
|
||
array.forEach((currentElement, currentIndex) => { | ||
array.slice(currentIndex + 1).forEach((elementToCompare) => { |
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.
could you explain the purpose of the slice() method here?
const isAllUniqueElements = (array) => { | ||
let isAllUnique = true; | ||
|
||
array.forEach((currentElement, currentIndex) => { |
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.
Is there a way we can do this without having a nested loop?
const isAllUniqueElements = (array) => { | ||
let isAllUnique = true; | ||
|
||
array.forEach((currentElement, currentIndex) => { |
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.
i like how each variable is descriptively named!
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.
whoops ignore, was thinking in Swift
@@ -0,0 +1,16 @@ | |||
|
|||
const isAllUniqueElements = (array) => { | |||
let isAllUnique = true; |
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.
perhaps change this to Var so it could be used outside the function?
const isAllUniqueElements = (array) => { | ||
let isAllUnique = true; | ||
|
||
array.forEach((currentElement, currentIndex) => { |
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.
Can we used an object instead of a loop?
No description provided.