Javascript - Integer

About

Integer aren't implemented in javascript, only double exists. See Javascript - Number (Double)

With integers, you have to take care that all calculations fit within the range between –2^53 and 2^53, but you don’t have to worry about rounding errors.

Be careful

There is no integer in javascript but float

var myNumber = 0.1 + 0.2 

console.log("myNumber is not 0.3 but " + myNumber) 

Sequence

sequence with the map function

let seq = Array(8).fill().map( (element, index) => index ) ;
console.log(seq)

From

String

parseInt with a string and a base

parseInt(string,base)

Example

let i = parseInt("5.01",10); // 5
if (i>=5){
  console.log(`i (${i}) is greater or equal to 5`);
} else {
  console.log(`i (${i})  is less than 5`);
}





Discover More
Javascript - Number (Double)

Most programming languages have several types of numeric data, but JavaScript gets away with just one. All numbers are and are stored as doubles. See also': 32 bit 53 bit - the max of double-precision...
Javascript - String

The in javascript. A string in JavaScript is encoded with the ucs-2 16-bit character set. An element of a JavaScript string is therefore a 16-bit code unit. code unitscode pointssurrogate pair Strings...



Share this page:
Follow us:
Task Runner