how to write array filter code example

Example 1: the filter array

var id = 2;
var list = [{
  Id: 1,
  Name: 'a'
}, {
  Id: 2,
  Name: 'b'
}, {
  Id: 3,
  Name: 'c'
}];
var lists = list.filter(x => {
  return x.Id != id;
})
console.log(lists);

Example 2: JavaScript Array Methods .filter()

const colours = ['green', 'black', 'dark-orange', 'light-yellow', 'azure'];
// a 6 karakternél hosszab színekre szűrünk:
const result = colours.filter(colour => colour.length > 6);
console.log(result);
// --> [ 'dark-orange', 'light-yellow' ]