DEV Community

Discussion on: Integer division in JavaScript explained

Collapse
 
jonrandy profile image
Jon Randy 🎖️

All numbers in JavaScript are of type Number

Except those that are of type BigInt. Integer division works straight away with those:

let a = 100n
let b = 3n
let c = a/b

console.log(c)  // 33n
console.log(typeof c)  // bigint
Enter fullscreen mode Exit fullscreen mode
Collapse
 
lavary profile image
Reza Lavarian

Thanks you for the correction, Jon! I updated the article :-)