Sample array
var myItems = [{height:500, width:400},{height:500, width:800},{height:500, width:700}]
Instead of doing
if(myItems[0].height !== myItems[1].height && myItems[0].height !== myItems[2].height && myItems[1].height !== myItems[2].height){
// do smth about it
}
with larger arrays this code gonna get ridiculous, so I played with this
if (myItems.reduce((x,y)=>x.height!==y.height)){
// do the same thing
}
The problem is, this always returns true
even if the above values are in place, all items have same height
value.