filter is used to filter the array.
It creates a new array whose elements are checked by checking all elements in the specified array that meet the criteria.
Note: filter() will not detect empty arrays and will not change the original array
let nums = [1, 2, 3, 4, 3, 5, 6];
let res = nums.filter(item=> item !== 3);
console.log(res); // [1, 2, 4, 5, 6]