So you are a UI guy and cannot live without Underscore or Lodash when you write your JavaScript? Well, it is okay but have you ever look into the source of those libraries or you are using them just because everyone does. In this short series I will take methods from lodash and look through most of them to show you what is happening in these methods and why you are using them.
So let's get started. First method is compact. This method is very simple and just remove falsy methods from array.
function compact(array) {
var index = -1,