Skip to content

Instantly share code, notes, and snippets.

@donedgardo
Created February 8, 2017 19:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save donedgardo/c8150b264b0a620cc766c163dd67adc6 to your computer and use it in GitHub Desktop.
Save donedgardo/c8150b264b0a620cc766c163dd67adc6 to your computer and use it in GitHub Desktop.
ES6 Article
// Filter function to check what property was left null.
// notNullArray is now a an array with key whose values are not null
let notNullArray = arrayWithNulls.filter((prop) => {
// prop is an an element of the array (eg. {image: null})
for (var key in prop) {
// if the value of prop[key] is not null return it.
// eg. (key = image, and prop = { image:null } Won't return.
if(prop[key]){
return prop;
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment