proposal-array-filtering icon indicating copy to clipboard operation
proposal-array-filtering copied to clipboard

I did it again!

Open jridgewell opened this issue 5 years ago • 1 comments

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]`

jridgewell avatar Feb 25 '20 20:02 jridgewell

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).

lightmare avatar Jun 28 '21 19:06 lightmare