Currently diving into the world of JavaScript through the enlightening pages of Eloquent JavaScript. Chapter 5 has been a breeze so far, except for one line of code inside a console.log statement that has me stumped:
function filter(array, test) {
let passed = [];
for (let element of array) {
if (test(element)) {
passed.push(element);
}
}
return passed;
}
console.log(filter(SCRIPTS, script => script.living));
Yes, that one line. It's causing me quite the conundrum:
console.log(filter(SCRIPTS, script => script.living))
// → [{name: "Adlam", …}, …]
What in the world does script=>script.living actually do? Any insight would be greatly appreciated!