Answers for "filter array by keyword"

CSS
0

filter array by keyword

var data = [
  {email: "[email protected]",nama:"User A", Level:"Super Admin"},
  {email: "[email protected]",nama:"User B", Level:"Super Admin"},
  {email: "[email protected]",nama:"User C", Level:"Standart"},
  {email: "[email protected]",nama:"User D", Level:"Standart"},
  {email: "[email protected]",nama:"User E", Level:"Admin"},
  {email: "[email protected]",nama:"User F", Level:"Standart"}
];
var filter = "Level";
var keyword = "Standart";

var filteredData = data.filter(function(obj) {
	return obj[filter] === keyword;
});

console.log(filteredData);
Posted by: Guest on December-28-2020
0

filter array elements

int[] a = {1,2,3,4};
boolean contains = IntStream.of(a).anyMatch(x -> x == 4);
Posted by: Guest on July-26-2021

Browse Popular Code Answers by Language