const myArray = [2,4,5,6,9] my.Array.filter(el => el < 5) //keeps anything in new array that returns true // [2,4] //but it does not mutate the array, so myArray // remains [2,4,5,6,9]
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter