“JavaScript Bigint” Code-Antworten

JavaScript Bigint

const theBiggestInt = 9007199254740991n
const alsoHuge = BigInt(9007199254740991) // 9007199254740991n
const hugeString = BigInt("9007199254740991") // 9007199254740991n
const hugeHex = BigInt("0x1fffffffffffff") // 9007199254740991n
const hugeBin = BigInt("0b11111111111111111111111111111111111111111111111111111") // 9007199254740991n
TC5550

Warum Bigint JS

Why BigInt ? - To represent integer values larger than 2^53
madhav

JavaScript Bigint

// BigInt value
const value = 900719925124740998n;

// Adding two big integers
const value1 = value + 1n;
console.log(value1); // returns "900719925124740999n"
SAMER SAEID

JavaScript Bigint

// BigInt value
const value1 = 900719925124740998n;

// Adding two big integers
const result1 = value1 + 1n;
console.log(result1); // "900719925124740999n"

const value2 = 900719925124740998n;

// Error! BitInt and number cannot be added
const result2 = value2 + 1; 
console.log(result2);
SAMER SAEID

Ähnliche Antworten wie “JavaScript Bigint”

Fragen ähnlich wie “JavaScript Bigint”

Weitere verwandte Antworten zu “JavaScript Bigint” auf JavaScript

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen