let numbers = [5, 10, 12, 13, 17, 20, 21, 28]; let sumOfEvens = numbers.reduce((total,active) => { if (active % 2 === 0) { return active + total; console.log (`checking...even!`); } return total } , 0); console.log (sumOfEvens);
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