Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- global.fetch = require("cross-fetch");
- fetch("https://pastebin.com/raw/fvJkWEk5")
- .then(response => {
- return response.json();
- })
- .then(data => {
- var months = [
- "Jan",
- "Feb",
- "March",
- "April",
- "May",
- "June",
- "July",
- "August",
- "Sept",
- "Oct",
- "Nov",
- "Dec"
- ];
- var months_data = [
- {
- "female" : 0,
- "male" : 0,
- },
- {
- "female" : 0,
- "male" : 0,
- },
- {
- "female" : 0,
- "male" : 0,
- },
- {
- "female" : 0,
- "male" : 0,
- },
- {
- "female" : 0,
- "male" : 0,
- },
- {
- "female" : 0,
- "male" : 0,
- },
- {
- "female" : 0,
- "male" : 0,
- },
- {
- "female" : 0,
- "male" : 0,
- },
- {
- "female" : 0,
- "male" : 0,
- },
- {
- "female" : 0,
- "male" : 0,
- },
- {
- "female" : 0,
- "male" : 0,
- },
- {
- "female" : 0,
- "male" : 0,
- },
- ]
- json_data.map((u,i) => {
- months_data[parseInt(u.data.registration_time.split("-")[1]) - 1][u.data.sex.toLowerCase()]++;
- })
- months_data.map((u,i) => {
- console.log(months[i] + " male " + u.male + " female " + u.female);
- })
- })
- .catch(err => {
- console.error(err);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement