filter

Filter specific values from array of objects

var spells = [{ name : "fire", damage : 5 },{ name : "ice", damage : 4 }, { name : "water", damage : 5 }];
sb.filter(spells,{ damage : 5 });
-> [{ name : "fire", damage : 5 },{ name : "water", damage : 5 }]
var spells = [{ name : "fire", damage : 5 },{ name : "ice", damage : 4 }, { name : "water", damage : 5 }];
sb.filter(spells,{ name : "fire", name : "ice" });
-> [{ name : "fire", damage : 5 },{ name : "ice", damage : 4 }]

results matching ""

    No results matching ""