const arr = ["hello", false, 0, "", 7, true, "0", [], {}, null];
const filteredValues = arr.filter(Boolean);
console.log(filteredValues); // [ 'hello', 7, true, '0', [], {} ]
Thanks for reading π
Follow @codedrops.tech for more.
Instagram β Twitter β Facebook
Micro-Learning β Web Development β Javascript β MERN stack β Javascript
codedrops.tech
Projects
Note Box - A chrome extension to add notes/todos based on URL
File Ops - A VS Code extension to easily tag/alias files & quick switch between files
Top comments (1)