My First Playground

node v8.12.0
version: 1.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:
const mod10CheckDigit = require('mod10-check-digit') // single digit check digit const scheme_id = 1 const generation_id = 1 const totalbikes = 15 const cache = [] function getRandomInt() { return Math.floor(Math.random() * 90 + 10) } function generate() { const n = `${scheme_id}${generation_id}${getRandomInt()}` const check_num = mod10CheckDigit(n).toString() return `${n}${check_num}` } while (cache.length != totalbikes) { const frame_number = generate() if (!cache.includes(frame_number)) { console.log(frame_number) cache.push(frame_number) } }
Loading…

no comments

    sign in to comment