Home / JS / Useful One Line Functions
const rndInt = (max) => Math.floor(Math.random() * max) + 1;
const timeMS = (prevTime = 0) => Date.now() - prevTime;
let DEBUG = true; const debug = (...args) => DEBUG && console.log('DEBUG:', args);
const delay = (ms) => new Promise((res) => setTimeout(res, ms));
const concat = (...args) => args.join(' ');
Not quite one line
const cls = () => {
log('\u001b[3J\u001b[1J');
console.clear();
};
This page was generated by GitHub Pages. Page last modified: 22/10/19 12:57