Note_Tech

All technological notes.


Project maintained by simonangel-fong Hosted on GitHub Pages — Theme by mattgraham

JavaScript - BigInt

Back


BigInt

var x = 5n;
// var y = x / 2; // Error: Cannot mix BigInt and other types, use explicit conversion.

var y = Number(x) / 2;
console.log(y); //2.5

Create BigInt

var x = 9999999999999999n;
var y = BigInt(1234567890123456789012345);

console.log(typeof x); //bigint
console.log(typeof y); //bigint

TOP