@abbadon420@sh.itjust.works @not_IO@lemmy.blahaj.zone @programmer_humor@programming.dev I didn't know about this specific syntax you mentioned (import foo.bar as baz; what I'm aware and I use frequently is something like e.g. const log = console.log.bind(console)), I'm not even sure if it works as all my import use cases involve something installed from NPM or a relative-folder module file. But sometimes it's useful, and better, to have parametrized randomness, as in my helper functions I keep reusing across my personal projects: export const rand = (n, x) => Math.random() * (x - n) + n export const irand = (n, x) => Math.round(rand(n, x)) export const choose = a => a[irand(0, a.length-1)] (yeah, my choose helper lacks a proper verification of the input parameter, will return undefined if the array is empty or is not an array, but, well, it's for personal projects so I don't really worry about that; also I've been using Ruby more than I use JS, and Ruby got beautifully native array.sample and Random.rand(a..b))