As the name suggests TypedArray is an array for specific element types. There are mainly 9 types of Typed Array in Javascript.
TYPEDARRAY |
SIZE |
USES |
TYPE |
RANGE |
Int8Array | 1 | 8-bit 2’s complement signed integer. | byte | -128 to 127 |
Unit8Array | 1 | 8-bit 2’s complement signed octet. | octet | 0 to 255 |
Unit8ClampedArray | 1 | 8-bit unsigned integer (clamped) octet. | octet | 0 to 255 |
Int16Array | 2 | 16-bit 2’s complement signed integer. | short | -32768 to 32767 |
Unit16Array | 2 | 16-bit unsigned integer. | unsigned short | 0 to 65535
|
Int32Array | 4 | 32-bit 2’s complement signed integer. | long | -2147483648 to 2147483647 |
Uint32Array | 4 | 32-bit unsigned integer | unsigned long | 0 to 4294967295 |
Float32Array | 4 | 32-bit IEEE floating point number unrestricted float | unrestricted float | 1.2×10-38 to 3.4×1038 |
Float64Array | 8 | 64-bit IEEE floating point number unrestricted double | unrestricted double | 5.0×10-324 to 1.8×10308 |
TypedArray methods
copyWithin() Method: Use: To copy a portion of an array to another location in the same array and return the size without modification.
entries() Method: Use: To get a new Array Iterator object that contains key-value pairs for each index in the array.
every() Method: Use: To check whether all the elements of the array satisfy the given condition or not.
fill() Method: Use: To fill all the elements of the array from a start index to an end index with a static value.
filter() Method: Use: To form a new array that falls under a given criteria from an existing array.
find() Method: Use: To get the value of the first element in the array that satisfies the provided condition.
findIndex() Method: Use: To provide the index of the element that completes the given test in the array.
forEach() Method: Use: To call a specified function once for each element of the array.
includes() Method: Use: To determine whether a particular element is present in the array or not.
indexof() Method: Use: To find the index of the element provided as the argument to the function.
join() Method: Use: To join all the elements of an Array into a string.
keys() Method: Use: To get an Array Iterator object with the keys of an array.
lastIndexof() Method: Use: To get the last position of a value, or it returns -1 if the value is not found.
map() Method: Use: To form a new array with the result of calling a function for every element.
reduce() Method: Use: To reduce the elements of an array into a single value.
reduceRight() Method: Use: To reduce the elements of an array (from right to left) into a single value.
reverse() Method: Use: To reverse the array.
set() Method: Use: To store values in the given array.
Slice() Method: Use: To get the selected elements of the array on which is implemented.
some() Method: Use: To examine the elements of the array that satisfy the given condition or not.
sort() Method: Use: To sort the array and return the updated array.
subarray() Method: Use: To get a new array and it does not change the original array.
values() Method: Use: To define the value of the contents in the array
toLocaleString() Method: Use: To convert the element of the given array into a string.
toString() Method: Use: To convert the element of the given array into a string. And these Strings are separated by separators such as a comma “,”.
Please follow and like us: