Extra large or extra small numbers can be written with scientific (exponent) notation:
This format stores numbers in 64 bits, where the number (the fraction) is stored in bits 0 to 51, the exponent in bits 52 to 62, and the sign in bit 63.
When using + in JS, just remember it adds from left to right. So working with the addition of strings and numbers is simple. JS has NaN which means not a number. Arises when I do something like 100 / βappleβ.
If we go out of bounds (smaller than smallest number or larger than biggest number), JS will return Infinity or -Infinity, dividing by 0 also causes this.
We can make number objects:
However, we should not do this - slow + not useful.
Arrays is JS are the same as any other language. Can static make one or new one, but, never new one as it is pointless. We can access the entire array by passing the arrayβs name:
That fills the HTML with: Saab, Volvo, BMW.
In JS, arrays are objects, so typeof returns object for an array.
You can have objects in an Array. You can have functions in an Array. You can have arrays in an Array:
The real power of JS arrays are the built-in methods there are.
A note about objects and arrays. They are very similar:
The Difference Between Arrays and Objects
In JavaScript, arrays use numbered indexes.
In JavaScript, objects use named indexes.
There are many array methods and sorting methods in the reference above.
JS Map
The map() method creates a new array by performing a function on each array element:
JS Filter
The filter() method creates a new array with array elements that passes a test.