Created
November 3, 2016 02:10
-
-
Save code-for-coffee/54c8a19218ba4b4fb42314338bf2d296 to your computer and use it in GitHub Desktop.
CategoryCounter
This file contains 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
const json = require('./data.json'); | |
let counter = 0; | |
for (var i = 0; i < json.length; i++) { | |
let planet = json[i]; | |
let mass = planet['pl_bmassj']; | |
if (mass > 0) { | |
counter++; | |
} | |
} | |
console.log(`There are ${json.length} items and only ${counter} have logged masses.`); | |
// There are 3402 items and only 1193 have logged masses. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment