Skip to content

Latest commit

History

History
16 lines (9 loc) · 441 Bytes

File metadata and controls

16 lines (9 loc) · 441 Bytes

How to Use the Filter Method


In JavaScript, the .filter() method allows you to create a new array by returning the elements of a given array that pass a test implemented by the function you provide.

constyears=[2011,2012,2013,2014,2015]consteven=years.filter((year)=>year%2===0)console.log(even)

link