My First Playground

node v6.12.2
version: 2.0.0
endpointsharetweet
This is a playground to test JavaScript. It runs a completely standard copy of Node.js on a virtual server created just for you. Every one of npm’s 300,000+ packages are pre-installed, so try it out:
var ipaddresses = ['1.2.3.5','1.2.3.4','1.2.3.5','1.2.3.4','1.2.3.5','1.2.3.4','1.2.3.5','1.2.3.5','1.2.3.5','1.2.3.5','1.2.3.5','1.2.3.5','1.2.3.6','1.2.3.6','1.2.3.6','1.2.3.6','1.2.3.7','1.2.3.7','1.2.3.7','1.2.3.7','1.2.3.7','1.2.3.7','1.2.3.8','1.2.3.9','1.2.3.10'] var counts = ipaddresses.reduce((map, ip) => { map[ip] = (map[ip] || 0) + 1 return map }, {}) var sorted = Object.keys(counts).sort((a, b) => counts[b] - counts[a]); var top5 = sorted.slice(0,5) return top5
Loading…

no comments

    sign in to comment