DEV Community

loading...

Discussion on: Javascript Array Crash Course

Collapse
lukeshiru profile image
△ LUKE知る

The loop example doesn't need a for at all (generally you don't need loops with arrays in JS), you can just:

nums.filter(num => num % 2 === 0);
Enter fullscreen mode Exit fullscreen mode

A good resource to check: doesitmutate.xyz/