var ob=[
{name:'john', surname:'miller', role:'teacher'},
{name:'jill',surname:'smith', role:'student'},
{name:'jeff', surname:'summers', role:'student'},
{name:'lisa',surname:'kenson', role:'teacher'}];
let input = 'teacher';
var res = ob.filter(o=>Object.values(o).includes(input));
console.log(res)
Created
September 18, 2018 13:44
-
-
Save andrit/f649abfbb31d0abec5769e940aa4bc55 to your computer and use it in GitHub Desktop.
filter out the object that has a match for the key value
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment