Created
February 8, 2017 19:54
-
-
Save donedgardo/c8150b264b0a620cc766c163dd67adc6 to your computer and use it in GitHub Desktop.
ES6 Article
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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