world-population
Version:
World Population Counter, based on UN World Population Prospects data
19 lines (18 loc) • 905 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const index_1 = require("./index");
// Check estimate() function
console.log("World population when we landed on the moon:", (0, index_1.estimate)(new Date(1969, 6, 20)));
// Check estimateDate() function.
console.log("World population will reach 8 billion at:", (0, index_1.estimateDate)(8000000000));
console.log("World population will reach 9 billion at:", (0, index_1.estimateDate)(9000000000));
// Create a basic counter.
console.log("Another human is born every", (0, index_1.interval)(), "milliseconds.");
console.log("The numbers below show the increase in the world's population over the next 10 seconds...");
const intervalId = setInterval(() => {
console.log((0, index_1.estimate)());
}, (0, index_1.interval)());
setTimeout(() => {
clearInterval(intervalId);
console.log("That's all folks!");
}, 10000);