Javascript

Remove Empty Elements From An Array With Javascript

Posted by Weston Ganger on January 05, 2016

I needed a method similar to ruby’s compact but for javascript.

Here I will describe how to easily do this with pure js.


var my_array = my_array.filter(function(x){
  return (x !== (undefined || null || ''));
});


Related External Links:


Posted in Javascript and Tagged with javascript 


Want me to help develop your next project or application?

Contact Us

Specializing in Ruby-on-Rails, Javascript, Multi-Platform Electron Desktop Apps and Hybrid Cordova Mobile Apps.

Recommended Posts