proposal-array-filtering
proposal-array-filtering copied to clipboard
I did it again!
I meant to find the tuples with a difference, but wrote it backwards again!
$$('head meta')
.map(m => [m.content === m.getAttribute('content'), m.content, m.getAttribute('content')])
.filter(t => t[0]) // should be `!t[0]`
I find this confusion described in the readme mildly amusing :smiley_cat: It seems self-inflicted, perhaps stemming from using the terms "keep" and "remove" in the wrong context.
A filter is a device which stops bad stuff, and lets good stuff through.
Array.prototype.filter is not removing anything. It copies items from one array, runs them through a filter (predicate function deciding what's good=true/bad=false), and returns a new array of what comes out on the other side (good stuff).