Skip to content

Instantly share code, notes, and snippets.

@code-for-coffee
Created November 3, 2016 02:10
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 code-for-coffee/54c8a19218ba4b4fb42314338bf2d296 to your computer and use it in GitHub Desktop.
Save code-for-coffee/54c8a19218ba4b4fb42314338bf2d296 to your computer and use it in GitHub Desktop.
CategoryCounter
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