Answers for "remove null and undefined from array of objects javascript"

4

remove null from array of objects javascript

var array = [0, 1, null, 2, "", 3, undefined, 3,,,,,, 4,, 4,, 5,, 6,,,,];

var filtered = array.filter(function (el) {
  return el != null;
});

console.log(filtered);
Posted by: Guest on December-22-2019
0

remove null and undefined from array

// Removing null,undefined,0 value from array

const data = ['Abc',0,null,"Hello",undefined]

const filterData = data.filter(Boolean);

console.log(filterData)
Posted by: Guest on August-17-2021

Code answers related to "remove null and undefined from array of objects javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language