Search
 
SCRIPT & CODE EXAMPLE
 

TYPESCRIPT

typescript bigint vs number

// 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
Comment

PREVIOUS NEXT
Code Example
Typescript :: nestjs casl 
Typescript :: npm dotenv typescript 
Typescript :: number of elements in c++ array 
Typescript :: sort array elements in descending order based on object key 
Typescript :: react-native.ps1 cannot be loaded because running scripts is disabled on this system 
Typescript :: close mat dialog from component 
Typescript :: methods defined as testmethod do not support web service callouts 
Typescript :: python get first n elements of list 
Typescript :: copy text from file to another file in javascript with fs 
Typescript :: Angular 6 checkbox checked dynamically 
Typescript :: google sheets add all numbers in a column with condition 
Typescript :: ternary operator typescript 
Typescript :: how remove decimal points in java 
Typescript :: typescript array of objects interface 
Typescript :: an apparmor policy prevents this sender from sending this message to this recipient 
Typescript :: typescript quickly pdf 
Typescript :: How to compare two lists and return the number of times they match at each index in python 
Typescript :: typescript exclamation mark 
Typescript :: typescript typecast 
Typescript :: ternary operator in typescript 
Typescript :: NullInjectorError: R3InjectorError(DynamicTestModule)[AdminTestCentersComponent - ToastrService - InjectionToken ToastConfig - InjectionToken ToastConfig]: NullInjectorError: No provider for InjectionToken ToastConfig! 
Typescript :: nested slots in vue 
Typescript :: create custom properties for user firebase 
Typescript :: node js process on unhandled promise rejection 
Typescript :: python sort list according to two elements in tuple 
Typescript :: how to clear known_hosts in ssh 
Typescript :: search an array of objects with specific object property value 
Typescript :: typeorm find with limit 
Typescript :: How to add new row to a particular index of a ag grid using angular 7 
Typescript :: execute script when c# code gets executed 
ADD CONTENT
Topic
Content
Source link
Name
6+3 =