Skip to content

Latest commit

 

History

History

07 - Array Cardio Day 2

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Array Cardio Day 2

The continuation of the array workout takes us to use some new build-in methods:

Notes

There is a nice trick implemented in this exercise. Following a functional-programming style and making use fo the ES6 spread operator we delete an element from an array without leaving empty places:

const index = comments.findIndex(comment => comment.id === 823423);
const newComments = [         
	...comments.slice(0, index),
	...comments.slice(index + 1, comments.length)
];