Emulate a dice throw
JavaScript
const throwdice = () => ~~(Math.random() * 6) + 1TypeScript
const throwdice = (): number => ~~(Math.random() * 6) + 1Examples
throwdice() // 4
throwdice() // 1
throwdice() // 6const throwdice = () => ~~(Math.random() * 6) + 1const throwdice = (): number => ~~(Math.random() * 6) + 1throwdice() // 4
throwdice() // 1
throwdice() // 6