Skip to content

Instantly share code, notes, and snippets.

@anushshukla
Created January 13, 2021 09:05
Show Gist options
  • Select an option

  • Save anushshukla/e925fb2086a3880ed3b213ece2860a5f to your computer and use it in GitHub Desktop.

Select an option

Save anushshukla/e925fb2086a3880ed3b213ece2860a5f to your computer and use it in GitHub Desktop.
JSON string response find count of age > 50
const https = require('https');
const callback = response => {
let str = '';
response.on('data', function (chunk) {
str += chunk;
});
response.on('end', function () {
const count = str.match(/age=([5-9]\d{1,})/gm).length;
console.log(count);
});
}
https.get('https://coderbyte.com/api/challenges/json/age-counting', callback).end();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment