JSFiddle - React, Tailwind, and code Playground
by jrab227
JavaScript
var j = [{id:0}, {id:1}, {id:2}]
var k = j.filter(function(n){ return (n.id < 2)})
//for some reason filter passes references to j rather than new elements
//hence this mutates j[0]
k[0].id = 2
console.log(j.length)
console.log(k.length)
//just to check
console.log(j[0].id == k[0].id)