Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed JavaScript Array Iteration Methods!

- 2x 2x
- 1.75x 1.75x
- 1.5x 1.5x
- 1.25x 1.25x
- 1.1x 1.1x
- 1x 1x
- 0.75x 0.75x
- 0.5x 0.5x
The filter method can be used to remove elements from an array.
Snippets from the Video
const names = ['Selma', 'Ted', 'Mike', 'Sam', 'Sharon', 'Marvin'];
let sNames = [];
names.forEach(name => {
if(name.charAt(0) === 'S') {
sNames.push(name);
}
});
console.log(sNames);
const numbers = [1,2,3,4,5,6,7,8,9,10];
// Result: [2,4,6,8,10]
MDN Resources
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up-
karan Badhwar
Web Development Techdegree Graduate 18,135 Points1 Answer
-
Muaaz Matwadia
Full Stack JavaScript Techdegree Graduate 19,327 Points1 Answer
-
Tom McLean
11,045 Points2 Answers
-
Seth Miller
5,851 Points2 Answers
-
ammarkhan
Front End Web Development Techdegree Student 21,661 Points1 Answer
-
ammarkhan
Front End Web Development Techdegree Student 21,661 Points1 Answer
-
Tony Brackins
28,766 Points1 Answer
-
Michael Caveney
50,144 Points7 Answers
View all discussions for this video
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up