Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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)
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to add font family in material ui 
Javascript :: get keys wher value is true in object in javascript 
Javascript :: check if string is valid date 
Javascript :: ExpressionChangedAfterItHasBeenCheckedError: 
Javascript :: get DOM node with xpath 
Javascript :: how to update the object value of any array key based on value 
Javascript :: js check if object is empty 
Javascript :: jquery uncheck all other checkboxes when one is checked 
Javascript :: javascript print out 
Javascript :: importing svg into react 
Javascript :: pass data navigate react router dom 
Javascript :: how to get file size in node js 
Javascript :: get random numbers javascript 
Javascript :: Vanilla JS (on)load with page 
Javascript :: printf javasscript 
Javascript :: javascript check if text is overflowing 
Javascript :: react useeffect async 
Javascript :: flutter convert json string to json 
Javascript :: how to validate age above 18 in javascript 
Javascript :: javascript is valid json string 
Javascript :: mktime in js 
Javascript :: React Redux reducer combineReducers exemple 
Javascript :: number pyramid in javascript 
Javascript :: how to check div is display:none or block in javascript 
Javascript :: how to add a shadow react native 
Javascript :: nodejs recursively read directory 
Javascript :: javascript clone array of objects 
Javascript :: js console.log color 
Javascript :: localstorage javascript 
Javascript :: get checked radio button value jquery by name 
ADD CONTENT
Topic
Content
Source link
Name
3+6 =