Skip to content

Instantly share code, notes, and snippets.

@kro12
Last active April 28, 2016 11:23
Show Gist options
  • Save kro12/4aade5815b5f59b1aa9cfb977a108cec to your computer and use it in GitHub Desktop.
Save kro12/4aade5815b5f59b1aa9cfb977a108cec to your computer and use it in GitHub Desktop.
var count, elem, i, input, len;
input = [
{
"creative_carousel_image": null,
"creative_carousel_name": null,
"creative_carousel_description": null,
"creative_carousel_link": null,
"creative_carousel_message": null,
"creative_dpa_product_name": "asdasd",
"creative_dpa_description_price": "asdasd",
"creative_dpa_message": "asdasd"
}, {
"creative_carousel_image": null,
"creative_carousel_name": null,
"creative_carousel_description": null,
"creative_carousel_link": null,
"creative_carousel_message": null,
"creative_dpa_product_name": "asdasd",
"creative_dpa_description_price": "asdasda",
"creative_dpa_message": "asdasd"
}, {
"creative_carousel_image": null,
"creative_carousel_name": null,
"creative_carousel_description": null,
"creative_carousel_link": null,
"creative_carousel_message": null,
"creative_dpa_product_name": "asdasd",
"creative_dpa_description_price": "asdasd",
"creative_dpa_message": "asdasd"
}, {
"creative_carousel_image": null,
"creative_carousel_name": null,
"creative_carousel_description": null,
"creative_carousel_link": null,
"creative_carousel_message": null,
"creative_dpa_product_name": "asdasd",
"creative_dpa_description_price": "asdasda",
"creative_dpa_message": "asdasd"
}, {
"creative_carousel_image": null,
"creative_carousel_name": null,
"creative_carousel_description": null,
"creative_carousel_link": null,
"creative_carousel_message": null,
"creative_dpa_product_name": "asdasd",
"creative_dpa_description_price": "asdasd",
"creative_dpa_message": "asdasdasd"
}, {
"creative_carousel_image": null,
"creative_carousel_name": null,
"creative_carousel_description": null,
"creative_carousel_link": null,
"creative_carousel_message": null,
"creative_dpa_product_name": "asdasd",
"creative_dpa_description_price": "asdasda",
"creative_dpa_message": "asdasdasd"
}
];
count = 0;
for (i = 0, len = input.length; i < len; i++) {
elem = input[i];
count = count + _.compact(_.toArray(elem)).length;
}
console.error(count);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment