Created
January 13, 2021 09:05
-
-
Save anushshukla/e925fb2086a3880ed3b213ece2860a5f to your computer and use it in GitHub Desktop.
JSON string response find count of age > 50
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
| 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