-
-
Notifications
You must be signed in to change notification settings - Fork 50
Exercises completed #7
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
base: master
Are you sure you want to change the base?
Exercises completed #7
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.
Ternary operator is good in expressions but not instead of if statement
Exercises/1-remove.js
Outdated
@@ -1,7 +1,8 @@ | |||
'use strict'; | |||
|
|||
const removeElement = (array, item) => { | |||
// Remove item from array modifying original array | |||
const index = array.indexOf(item); | |||
index > -1 ? array.splice(index, 1) : array; |
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.
Use if statement instead
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.
Thank you!
Done.
Exercises/2-elements.js
Outdated
// Remove multiple items from array modifying original array | ||
for (const item of items) { | ||
const index = array.indexOf(item); | ||
index > -1 ? array.splice(index, 1) : array; |
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.
Ditto
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.
Done.
Exercises/3-unique.js
Outdated
const unique = array => { | ||
const newArray = []; | ||
for (const item of array) { | ||
!newArray.includes(item) ? newArray.push(item) : array; |
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.
Ditto
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.
Done.
Exercises/4-difference.js
Outdated
const difference = (array1, array2) => { | ||
const newArray = []; | ||
for (const item of array1) { | ||
!array2.includes(item) ? newArray.push(item) : 0; |
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.
Ditto
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.
Done.
No description provided.