View 0_reuse_code.js
This file contains 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
View gist:14213922b9127c8442b5b53f5345b647
This file contains 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 fs = require('fs'); | |
let population = JSON.parse(fs.readFileSync('population.json','utf8')); | |
population = population.filter(c => c.Year == "2016"); | |
population = population.map(c=> {return {code3:c['Country Code'],population:c.Value}}); | |
population = population.filter(c => c != null); | |
let country3to2 = JSON.parse(fs.readFileSync('3to2countrycode.json','utf8')); | |
population = population.filter(c => c != null); | |
population = population.map(c=> { |
View server.js
This file contains 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 http = require("http"); | |
const express = require("express"); | |
const app = express(); | |
app.set('view engine', 'ejs'); | |
const port = 5000; ; | |
app.get("/",(req,res)=> { | |
res.end("Hello world"); | |
}); |
View companies.js
This file contains 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
let companies = [ | |
'AAPL', | |
'MSFT', | |
'AMZN', | |
'GOOGL', | |
'FB', | |
'BRK.A', | |
'BABA' | |
//'SEHK: 700' // wechat's tencent | |
'JPM', |