Dattiloscritto bigint vs numero

Esempi di codice

0
0

dattiloscritto bigint vs numero

1. BigInt is an integer, number is a decimal
  //bigInt
  var BigNum1=100n;     	//ok
  var BigNum2=100.20n;    //error
  //number
  var Num1=100;           //ok
  var Num2=100.20;        //ok

2. Different implementation
The number can handle numbers up to 9007199254740991.
The BigInt can handle arbitrary long numbers, limited by the available memory of the system.

3. BigInt cannot be used in arithmetic operations with numbers
  let numVar=100;
  let bigVar= 100n;
  console.log(numVar+bigVar); // error

4. ...but you can compare them
  console.log(1n < 2)     //true
  console.log(2n > 1)     //true
  console.log(2n > 2)     //false
  console.log(2n >= 2)    //true

5. More details on the source

Pagine correlate

Pagine di esempio simili

In altre lingue

Questa pagina è in altre lingue

Русский
..................................................................................................................
English
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................