Search completed in 1.06 seconds.
111 results for "TypedArray":
Your results are loading. Please wait...
TypedArray - JavaScript
a typedarray object describes an array-like view of an underlying binary data buffer.
... there is no global property named typedarray, nor is there a directly visible typedarray constructor.
... description ecmascript 2015 defines a typedarray constructor that serves as the [[prototype]] of all typedarray constructors.
...And 52 more matches
TypedArray.from() - JavaScript
the typedarray.from() method creates a new typed array from an array-like or iterable object.
... syntax typedarray.from(source[, mapfn[, thisarg]]) where typedarray is one of: int8array uint8array uint8clampedarray int16array uint16array int32array uint32array float32array float64array bigint64array biguint64array parameters source an array-like or iterable object to convert to a typed array.
... return value a new typedarray instance.
...And 9 more matches
TypedArray.of() - JavaScript
the typedarray.of() method creates a new typed array from a variable number of arguments.
... syntax typedarray.of(element0[, element1[, ...[, elementn]]]) where typedarray is one of: int8array uint8array uint8clampedarray int16array uint16array int32array uint32array float32array float64array bigint64array biguint64array parameters elementn elements of which to create the typed array.
... return value a new typedarray instance.
...And 3 more matches
TypedArray.prototype.join() - JavaScript
typedarray is one of the typed array types here.
... syntax typedarray.join([separator = ',']); parameters separator optional.
... polyfill since there is no global object with the name typedarray, polyfilling must be done on an "as needed" basis.
...And 2 more matches
TypedArray.prototype.slice() - JavaScript
typedarray is one of the typed array types here.
... syntax typedarray.slice([begin[, end]]) parameters begin optional zero-based index at which to begin extraction.
... if end is omitted, slice extracts through the end of the sequence (typedarray.length).
...And 2 more matches
TypedArray.prototype.some() - JavaScript
typedarray is one of the typed array types here.
... syntax typedarray.some(callback[, thisarg]) parameters callback function to test for each element, taking three arguments: currentvalue the current element being processed in the typed array.
... polyfill since there is no global object with the name typedarray, polyfilling must be done on an "as needed" basis.
...And 2 more matches
TypedArray.prototype.subarray() - JavaScript
the subarray() method returns a new typedarray on the same arraybuffer store and with the same element types as for this typedarray object.
...typedarray is one of the typed array types.
... syntax typedarray.subarray([begin [,end]]) parameters begin optional element to begin at.
...And 2 more matches
TypedArray.prototype.toString() - JavaScript
typedarray is one of the typed array types here.
... syntax typedarray.tostring() return value a string representing the elements of the typed array.
... examples the typedarray objects override the tostring method of object.
...And 2 more matches
TypedArray.BYTES_PER_ELEMENT - JavaScript
the typedarray.bytes_per_element property represents the size in bytes of each element in an typed array.
... property attributes of typedarray.bytes_per_element writable no enumerable no configurable no description typedarray objects differ from each other in the number of bytes per element and in the way the bytes are interpreted.
... the bytes_per_element constant contains the number of bytes each element in the given typedarray has.
... // 1 uint8clampedarray.bytes_per_element; // 1 int16array.bytes_per_element; // 2 uint16array.bytes_per_element; // 2 int32array.bytes_per_element; // 4 uint32array.bytes_per_element; // 4 float32array.bytes_per_element; // 4 float64array.bytes_per_element; // 8 specifications specification ecmascript (ecma-262)the definition of 'typedarray.bytes_per_element' in that specification.
TypedArray.prototype.buffer - JavaScript
the buffer accessor property represents the arraybuffer referenced by a typedarray at construction time.
...the value is established when the typedarray is constructed and cannot be changed.
... typedarray is one of the typedarray objects.
... examples using the buffer property var buffer = new arraybuffer(8); var uint16 = new uint16array(buffer); uint16.buffer; // arraybuffer { bytelength: 8 } specifications specification ecmascript (ecma-262)the definition of 'typedarray.prototype.buffer' in that specification.
TypedArray.prototype.byteLength - JavaScript
the value is established when a typedarray is constructed and cannot be changed.
... if the typedarray is not specifying an byteoffset or a length, the length of the referenced arraybuffer will be returned.
... typedarray is one of the typedarray objects.
... uint8array(buffer); uint8.bytelength; // 8 (matches the bytelength of the buffer) var uint8 = new uint8array(buffer, 1, 5); uint8.bytelength; // 5 (as specified when constructing the uint8array) var uint8 = new uint8array(buffer, 2); uint8.bytelength; // 6 (due to the offset of the constructed uint8array) specifications specification ecmascript (ecma-262)the definition of 'typedarray.prototype.bytelength' in that specification.
TypedArray.prototype.fill() - JavaScript
typedarray is one of the typed array types here.
... syntax typedarray.fill(value[, start = 0[, end = this.length]]) parameters value value to fill the typed array with.
... polyfill since there is no global object with the name typedarray, polyfilling must be done on an "as needed" basis.
... // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.fill if (!uint8array.prototype.fill) { uint8array.prototype.fill = array.prototype.fill; } examples using fill new uint8array([1, 2, 3]).fill(4); // uint8array [4, 4, 4] new uint8array([1, 2, 3]).fill(4, 1); // uint8array [1, 4, 4] new uint8array([1, 2, 3]).fill(4, 1, 2); // uint8array [1, 4, 3] new uint8array([1, 2, 3]).fill(4, 1, 1); // uint8array [1, 2, 3] new uint8array([1, 2, 3]).fill(4, -3, -2); // uint8array [4, 2, 3] specifications specification ecmascript (ecma-262)the definition of 'typedarray.prototype.fill' in that specification.
TypedArray.prototype.filter() - JavaScript
typedarray is one of the typed array types here.
... syntax typedarray.filter(callback[, thisarg]) parameters callback function to test each element of the typed array.
... invoked with arguments (element, index, typedarray).
... new uint8array([12, 5, 8, 130, 44]).filter(elem => elem >= 10); // uint8array [ 12, 130, 44 ] specifications specification ecmascript (ecma-262)the definition of 'typedarray.prototype.filter' in that specification.
TypedArray.prototype.length - JavaScript
the value is established when a typedarray is constructed and cannot be changed.
... if the typedarray is not specifying an byteoffset or a length, the length of the referenced arraybuffer will be returned.
... typedarray is one of the typedarray objects.
... var uint8 = new uint8array(buffer); uint8.length; // 8 (matches the length of the buffer) var uint8 = new uint8array(buffer, 1, 5); uint8.length; // 5 (as specified when constructing the uint8array) var uint8 = new uint8array(buffer, 2); uint8.length; // 6 (due to the offset of the constructed uint8array) specifications specification ecmascript (ecma-262)the definition of 'typedarray.prototype.length' in that specification.
TypedArray.prototype.reduce() - JavaScript
typedarray is one of the typed array types here.
... syntax typedarray.reduce(callback[, initialvalue]) parameters callback function to execute on each value in the typed array, taking four arguments: previousvalue the value previously returned in the last invocation of the callback, or initialvalue, if supplied (see below).
... polyfill this method uses the same algorithm as array.prototype.reduce(), so the same polyfill can be used here: simply replace array.prototype.reduce with typedarray.prototype.reduce.
... examples sum up all values within an array var total = new uint8array([0, 1, 2, 3]).reduce(function(a, b) { return a + b; }); // total == 6 specifications specification ecmascript (ecma-262)the definition of '%typedarray%.prototype.reduce' in that specification.
TypedArray.prototype.reduceRight() - JavaScript
typedarray is one of the typed array types here.
... syntax typedarray.reduceright(callback[, initialvalue]) parameters callback function to execute on each value in the typed array, taking four arguments: previousvalue the value previously returned in the last invocation of the callback, or initialvalue, if supplied (see below).
... the call to the reduceright callback would look something like this: typedarray.reduceright(function(previousvalue, currentvalue, index, typedarray) { // ...
... examples sum up all values within an array var total = new uint8array([0, 1, 2, 3]).reduceright(function(a, b) { return a + b; }); // total == 6 specifications specification ecmascript (ecma-262)the definition of '%typedarray%.prototype.reduceright' in that specification.
get TypedArray[@@species] - JavaScript
the typedarray[@@species] accessor property returns the constructor of a typed array.
...your custom typed array mytypedarray), the mytypedarray species is the mytypedarray constructor.
... however, you might want to overwrite this, in order to return a parent typed array object in your derived class methods: class mytypedarray extends uint8array { // overwrite mytypedarray species to the parent uint8array constructor static get [symbol.species]() { return uint8array; } } specifications specification ecmascript (ecma-262)the definition of 'get %typedarray% [ @@species ]' in that specification.
TypedArray.prototype.byteOffset - JavaScript
the value is established when a typedarray is constructed and cannot be changed.
... typedarray is one of the typedarray objects.
... examples using the byteoffset property var buffer = new arraybuffer(8); var uint8 = new uint8array(buffer); uint8.byteoffset; // 0 (no offset specified) var uint8 = new uint8array(buffer, 3); uint8.byteoffset; // 3 (as specified when constructing uint8array) specifications specification ecmascript (ecma-262)the definition of 'typedarray.prototype.byteoffset' in that specification.
TypedArray.prototype.copyWithin() - JavaScript
typedarray is one of the typed array types here.
... syntax typedarray.copywithin(target, start[, end = this.length]) parameters target target start index position where to copy the elements to.
... examples using copywithin var buffer = new arraybuffer(8); var uint8 = new uint8array(buffer); uint8.set([1,2,3]); console.log(uint8); // uint8array [ 1, 2, 3, 0, 0, 0, 0, 0 ] uint8.copywithin(3,0,3); console.log(uint8); // uint8array [ 1, 2, 3, 1, 2, 3, 0, 0 ] specifications specification ecmascript (ecma-262)the definition of 'typedarray.prototype.copywithin' in that specification.
TypedArray.prototype.every() - JavaScript
typedarray is one of the typed array types here.
... syntax typedarray.every(callback[, thisarg]) parameters callback function to test for each element, taking three arguments: currentvalue the current element being processed in the typed array.
... new uint8array([12, 5, 8, 130, 44]).every(elem => elem >= 10); // false new uint8array([12, 54, 18, 130, 44]).every(elem => elem >= 10); // true specifications specification ecmascript (ecma-262)the definition of 'typedarray.prototype.every' in that specification.
TypedArray.prototype.find() - JavaScript
typedarray is one of the typed array types here.
... syntax typedarray.find(callback[, thisarg]) parameters callback function to execute on each value in the typed array, taking three arguments: element the current element being processed in the typed array.
... function isprime(element, index, array) { var start = 2; while (start <= math.sqrt(element)) { if (element % start++ < 1) { return false; } } return element > 1; } var uint8 = new uint8array([4, 5, 8, 12]); console.log(uint8.find(isprime)); // 5 specifications specification ecmascript (ecma-262)the definition of '%typedarray%.prototype.find' in that specification.
TypedArray.prototype.findIndex() - JavaScript
syntax typedarray.findindex(callback[, thisarg]) parameters callback function to execute on each value in the typed array, taking three arguments: element the current element being processed in the typed array.
... polyfill typedarray.prototype.findindex = array.prototype.findindex = array.prototype.findindex || function(evaluator, thisarg) { 'use strict'; if (!this) { throw new typeerror('array.prototype.some called on null or undefined'); } if (typeof(evaluator) !== 'function') { if (typeof(evaluator) === 'string') { // attempt to convert it to a func...
...tart <= math.sqrt(element)) { if (element % start++ < 1) { return false; } } return element > 1; } var uint8 = new uint8array([4, 6, 8, 12]); var uint16 = new uint16array([4, 6, 7, 12]); console.log(uint8.findindex(isprime)); // -1, not found console.log(uint16.findindex(isprime)); // 2 specifications specification ecmascript (ecma-262)the definition of '%typedarray%.prototype.findindex' in that specification.
TypedArray.prototype.forEach() - JavaScript
typedarray is one of the typed array types here.
... syntax typedarray.foreach(callback[, thisarg]) parameters callback function that produces an element of the new typed array, taking three arguments: currentvalue the current element being processed in the typed array.
...contents of a typed array the following code logs a line for each element in a typed array: function logarrayelements(element, index, array) { console.log('a[' + index + '] = ' + element); } new uint8array([0, 1, 2, 3]).foreach(logarrayelements); // logs: // a[0] = 0 // a[1] = 1 // a[2] = 2 // a[3] = 3 specifications specification ecmascript (ecma-262)the definition of '%typedarray%.prototype.foreach' in that specification.
TypedArray.prototype.includes() - JavaScript
typedarray is one of the typed array types here.
... syntax typedarray.includes(searchelement[, fromindex]); parameters searchelement the element to search for.
...(4); // false uint8.includes(3, 3); // false // nan handling (only true for float32 and float64) new uint8array([nan]).includes(nan); // false, since the nan passed to the constructor gets converted to 0 new float32array([nan]).includes(nan); // true; new float64array([nan]).includes(nan); // true; specifications specification ecmascript (ecma-262)the definition of 'typedarray.prototype.includes' in that specification.
TypedArray.prototype.indexOf() - JavaScript
typedarray is one of the typed array types here.
... syntax typedarray.indexof(searchelement[, fromindex = 0]) parameters searchelement element to locate in the typed array.
... examples using indexof var uint8 = new uint8array([2, 5, 9]); uint8.indexof(2); // 0 uint8.indexof(7); // -1 uint8.indexof(9, 2); // 2 uint8.indexof(2, -1); // -1 uint8.indexof(2, -3); // 0 specifications specification ecmascript (ecma-262)the definition of 'typedarray.prototype.indexof' in that specification.
TypedArray.prototype.lastIndexOf() - JavaScript
typedarray is one of the typed array types here.
... syntax typedarray.lastindexof(searchelement[, fromindex = typedarray.length]) parameters searchelement element to locate in the typed array.
... examples using lastindexof var uint8 = new uint8array([2, 5, 9, 2]); uint8.lastindexof(2); // 3 uint8.lastindexof(7); // -1 uint8.lastindexof(2, 3); // 3 uint8.lastindexof(2, 2); // 0 uint8.lastindexof(2, -2); // 0 uint8.lastindexof(2, -1); // 3 specifications specification ecmascript (ecma-262)the definition of 'typedarray.prototype.lastindexof' in that specification.
TypedArray.prototype.map() - JavaScript
typedarray is one of the typed array types here.
... syntax typedarray.map(mapfn[, thisarg]) parameters mapfn a callback function that produces an element of the new typed array, taking three arguments: currentvalue the current element being processed in the typed array.
... const numbers = new uint8array([1, 4, 9]); const doubles = numbers.map(function(num) { return num * 2; }); // doubles is now uint8array [2, 8, 18] // numbers is still uint8array [1, 4, 9] specifications specification ecmascript (ecma-262)the definition of 'typedarray.prototype.map' in that specification.
TypedArray.name - JavaScript
the typedarray.name property represents a string value of the typed array constructor name.
... property attributes of typedarray.name writable no enumerable no configurable no description typedarray objects differ from each other in the number of bytes per element and in the way the bytes are interpreted.
... "uint8array" uint8clampedarray.name; // "uint8clampedarray" int16array.name; // "int16array" uint16array.name; // "uint16array" int32array.name; // "int32array" uint32array.name; // "uint32array" float32array.name; // "float32array" float64array.name; // "float64array" specifications specification ecmascript (ecma-262)the definition of 'typedarray.name' in that specification.
TypedArray.prototype.reverse() - JavaScript
typedarray is one of the typed array types here.
... syntax typedarray.reverse(); return value the reversed array.
... examples using reverse var uint8 = new uint8array([1, 2, 3]); uint8.reverse(); console.log(uint8); // uint8array [3, 2, 1] specifications specification ecmascript (ecma-262)the definition of 'typedarray.prototype.reverse' in that specification.
TypedArray.prototype.set() - JavaScript
syntax typedarray.set(array[, offset]) typedarray.set(typedarray[, offset]) parameters array the array from which to copy values.
... typedarray if the source array is a typed array, the two arrays may share the same underlying arraybuffer; the javascript engine will intelligently copy the source range of the buffer to the destination range.
... examples using set() var buffer = new arraybuffer(8); var uint8 = new uint8array(buffer); uint8.set([1, 2, 3], 3); console.log(uint8); // uint8array [ 0, 0, 0, 1, 2, 3, 0, 0 ] specifications specification ecmascript (ecma-262)the definition of 'typedarray.prototype.set' in that specification.
TypedArray.prototype.sort() - JavaScript
typedarray is one of the typed array types here.
... syntax typedarray.sort([comparefunction]) parameters comparefunction optional specifies a function that defines the sort order.
... // regular arrays require a compare function to sort numerically: numbers = [40, 1, 5, 200]; numbers.sort(); // [1, 200, 40, 5] numbers.sort((a, b) => a - b); // compare numbers // [ 1, 5, 40, 200 ] specifications specification ecmascript (ecma-262)the definition of 'typedarray.prototype.sort' in that specification.
TypedArray.prototype.toLocaleString() - JavaScript
typedarray is one of the typed array types here.
... syntax typedarray.tolocalestring([locales [, options]]); parameters the locales and options arguments customize the behavior of the function and let applications specify the language whose formatting conventions should be used.
...nt = new uint32array([2000, 500, 8123, 12, 4212]); uint.tolocalestring(); // if run in a de-de locale // "2.000,500,8.123,12,4.212" uint.tolocalestring('en-us'); // "2,000,500,8,123,12,4,212" uint.tolocalestring('ja-jp', { style: 'currency', currency: 'jpy' }); // "¥2,000,¥500,¥8,123,¥12,¥4,212" specifications specification ecmascript (ecma-262)the definition of 'typedarray.prototype.tolocalestring' in that specification.
TypedArray.prototype[@@iterator]() - JavaScript
.log(n); } alternative iteration var arr = new uint8array([10, 20, 30, 40, 50]); var earr = arr[symbol.iterator](); console.log(earr.next().value); // 10 console.log(earr.next().value); // 20 console.log(earr.next().value); // 30 console.log(earr.next().value); // 40 console.log(earr.next().value); // 50 specifications specification ecmascript (ecma-262)the definition of '%typedarray%.prototype[@@iterator]()' in that specification.
TypedArray.prototype.entries() - JavaScript
tive iteration var arr = new uint8array([10, 20, 30, 40, 50]); var earr = arr.entries(); console.log(earr.next().value); // [0, 10] console.log(earr.next().value); // [1, 20] console.log(earr.next().value); // [2, 30] console.log(earr.next().value); // [3, 40] console.log(earr.next().value); // [4, 50] specifications specification ecmascript (ecma-262)the definition of '%typedarray%.prototype.entries()' in that specification.
TypedArray.prototype.keys() - JavaScript
rray) { console.log(n); } alternative iteration var arr = new uint8array([10, 20, 30, 40, 50]); var earr = arr.keys(); console.log(earr.next().value); // 0 console.log(earr.next().value); // 1 console.log(earr.next().value); // 2 console.log(earr.next().value); // 3 console.log(earr.next().value); // 4 specifications specification ecmascript (ecma-262)the definition of '%typedarray%.prototype.keys()' in that specification.
TypedArray.prototype.values() - JavaScript
console.log(n); } alternative iteration var arr = new uint8array([10, 20, 30, 40, 50]); var earr = arr.values(); console.log(earr.next().value); // 10 console.log(earr.next().value); // 20 console.log(earr.next().value); // 30 console.log(earr.next().value); // 40 console.log(earr.next().value); // 50 specifications specification ecmascript (ecma-262)the definition of '%typedarray%.prototype.values()' in that specification.
StringView - Archive of obsolete content
ninptlen - nstartidx : nlength); break typeswitch; case uint32array: case uint16array: case uint8array: /* the input argument is a typedarray: the buffer, and possibly the array itself, will be shared.
...nstartidx + nlength : ninptlen); break typeswitch; default: /* the input argument is an array or another serializable object: a new typedarray will be created.
...nstartidx + nlength : ninptlen); } break typeswitch; default: /* the input argument is a number, a boolean or a function: a new typedarray will be created.
...And 10 more matches
Float32Array() constructor - JavaScript
syntax new float32array(); // new in es2017 new float32array(length); new float32array(typedarray); new float32array(object); new float32array(buffer [, byteoffset [, length]]); parameters length when called with a length argument, an internal array buffer is created in memory, of size length multiplied by bytes_per_element bytes, containing zeros.
... typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as int32array), the typedarray gets copied into a new typed array.
... each value in typedarray is converted to the corresponding type of the constructor before being copied into the new array.
...And 4 more matches
Float64Array() constructor - JavaScript
syntax new float64array(); // new in es2017 new float64array(length); new float64array(typedarray); new float64array(object); new float64array(buffer [, byteoffset [, length]]); parameters length when called with a length argument, an internal array buffer is created in memory, of size length multiplied by bytes_per_element bytes, containing zeros.
... typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as int32array), the typedarray gets copied into a new typed array.
... each value in typedarray is converted to the corresponding type of the constructor before being copied into the new array.
...And 4 more matches
Int16Array() constructor - JavaScript
syntax new int16array(); // new in es2017 new int16array(length); new int16array(typedarray); new int16array(object); new int16array(buffer [, byteoffset [, length]]); parameters length when called with a length argument, an internal array buffer is created in memory, of size length multiplied by bytes_per_element bytes, containing zeros.
... typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as int32array), the typedarray gets copied into a new typed array.
... each value in typedarray is converted to the corresponding type of the constructor before being copied into the new array.
...And 4 more matches
Int32Array() constructor - JavaScript
syntax new int32array(); // new in es2017 new int32array(length); new int32array(typedarray); new int32array(object); new int32array(buffer [, byteoffset [, length]]); parameters length when called with a length argument, an internal array buffer is created in memory, of size length multiplied by bytes_per_element bytes, containing zeros.
... typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as int32array), the typedarray gets copied into a new typed array.
... each value in typedarray is converted to the corresponding type of the constructor before being copied into the new array.
...And 4 more matches
Uint16Array() constructor - JavaScript
syntax new uint16array(); // new in es2017 new uint16array(length); new uint16array(typedarray); new uint16array(object); new uint16array(buffer [, byteoffset [, length]]); parameters length when called with a length argument, an internal array buffer is created in memory, of size length multiplied by bytes_per_element bytes, containing zeros.
... typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as int32array), the typedarray gets copied into a new typed array.
... each value in typedarray is converted to the corresponding type of the constructor before being copied into the new array.
...And 4 more matches
Uint32Array() constructor - JavaScript
syntax new uint32array(); // new in es2017 new uint32array(length); new uint32array(typedarray); new uint32array(object); new uint32array(buffer [, byteoffset [, length]]); parameters length when called with a length argument, an internal array buffer is created in memory, of size length multiplied by bytes_per_element bytes, containing zeros.
... typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as int32array), the typedarray gets copied into a new typed array.
... each value in typedarray is converted to the corresponding type of the constructor before being copied into the new array.
...And 4 more matches
Uint8Array() constructor - JavaScript
syntax new uint8array(); // new in es2017 new uint8array(length); new uint8array(typedarray); new uint8array(object); new uint8array(buffer [, byteoffset [, length]]); parameters length when called with a length argument, an internal array buffer is created in memory, of size length multiplied by bytes_per_element bytes, containing zeros.
... typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as int32array), the typedarray gets copied into a new typed array.
... each value in typedarray is converted to the corresponding type of the constructor before being copied into the new array.
...And 4 more matches
Uint8ClampedArray() constructor - JavaScript
syntax new uint8clampedarray(); // new in es2017 new uint8clampedarray(length); new uint8clampedarray(typedarray); new uint8clampedarray(object); new uint8clampedarray(buffer [, byteoffset [, length]]); parameters length when called with a length argument, an internal array buffer is created in memory, of size length multiplied by bytes_per_element bytes, containing zeros.
... typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as int32array), the typedarray gets copied into a new typed array.
... each value in typedarray is converted to the corresponding type of the constructor before being copied into the new array.
...And 4 more matches
WebIDL bindings
"spidermonkey" interfaces typed array, array buffer, and array buffer view arguments are represented by the objects in typedarray.h.
... for example, this webidl: interface test { void passtypedarraybuffer(arraybuffer arg); void passtypedarray(arraybufferview arg); void passint16array(int16array?
... arg); } will correspond to these c++ function declarations: void passtypedarraybuffer(const arraybuffer& arg); void passtypedarray(const arraybufferview& arg); void passint16array(const nullable<int16array>& arg); typed array return values become a js::mutablehandle<jsobject*> out param appended to the argument list.
...And 3 more matches
BigInt64Array() constructor - JavaScript
syntax new bigint64array(); new bigint64array(length); new bigint64array(typedarray); new bigint64array(object); new bigint64array(buffer [, byteoffset [, length]]); parameters length when called with a length argument, an internal array buffer is created in memory, of size length multiplied by bytes_per_element bytes, containing zeros.
... typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as int32array), the typedarray gets copied into a new typed array.
... each value in typedarray is converted to the corresponding type of the constructor before being copied into the new array.
...And 3 more matches
BigUint64Array() constructor - JavaScript
syntax new biguint64array(); new biguint64array(length); new biguint64array(typedarray); new biguint64array(object); new biguint64array(buffer [, byteoffset [, length]]); parameters length when called with a length argument, an internal array buffer is created in memory, of size length multiplied by bytes_per_element bytes, containing zeros.
... typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as int32array), the typedarray gets copied into a new typed array.
... each value in typedarray is converted to the corresponding type of the constructor before being copied into the new array.
...And 3 more matches
Int8Array() constructor - JavaScript
syntax new int8array(); // new in es2017 new int8array(length); new int8array(typedarray); new int8array(object); new int8array(buffer [, byteoffset [, length]]); parameters length when called with a length argument, an internal array buffer is created in memory, of size length multiplied by bytes_per_element bytes, containing zeros.
... typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as int32array), the typedarray gets copied into a new typed array.
... each value in typedarray is converted to the corresponding type of the constructor before being copied into the new array.
...And 3 more matches
Atomics.add() - JavaScript
syntax atomics.add(typedarray, index, value) parameters typedarray an integer typed array.
... index the position in the typedarray to add a value to.
... return value the old value at the given position (typedarray[index]).
...And 2 more matches
Atomics.and() - JavaScript
syntax atomics.and(typedarray, index, value) parameters typedarray an integer typed array.
... index the position in the typedarray to compute the bitwise and.
... return value the old value at the given position (typedarray[index]).
...And 2 more matches
Atomics.compareExchange() - JavaScript
syntax atomics.compareexchange(typedarray, index, expectedvalue, replacementvalue) parameters typedarray an integer typed array.
... index the position in the typedarray to exchange a value.
... return value the old value at the given position (typedarray[index]).
...And 2 more matches
Atomics.exchange() - JavaScript
syntax atomics.exchange(typedarray, index, value) parameters typedarray an integer typed array.
... index the position in the typedarray to exchange a value.
... return value the old value at the given position (typedarray[index]).
...And 2 more matches
Atomics.load() - JavaScript
syntax atomics.load(typedarray, index) parameters typedarray an integer typed array.
... index the position in the typedarray to load from.
... return value the value at the given position (typedarray[index]).
...And 2 more matches
Atomics.or() - JavaScript
syntax atomics.or(typedarray, index, value) parameters typedarray an integer typed array.
... index the position in the typedarray to compute the bitwise or.
... return value the old value at the given position (typedarray[index]).
...And 2 more matches
Atomics.sub() - JavaScript
syntax atomics.sub(typedarray, index, value) parameters typedarray an integer typed array.
... index the position in the typedarray to subtract a value from.
... return value the old value at the given position (typedarray[index]).
...And 2 more matches
Atomics.xor() - JavaScript
syntax atomics.xor(typedarray, index, value) parameters typedarray an integer typed array.
... index the position in the typedarray to compute the bitwise xor.
... return value the old value at the given position (typedarray[index]).
...And 2 more matches
Atomics.notify() - JavaScript
syntax atomics.notify(typedarray, index, count) parameters typedarray a shared int32array.
... index the position in the typedarray to wake up on.
... exceptions throws a typeerror, if typedarray is not a int32array.
... throws a rangeerror, if index is out of bounds in the typedarray.
Atomics.store() - JavaScript
syntax atomics.store(typedarray, index, value) parameters typedarray an integer typed array.
... index the position in the typedarray to store a value in.
... exceptions throws a typeerror, if typedarray is not one of the allowed integer types.
... throws a rangeerror, if index is out of bounds in the typedarray.
Atomics.wait() - JavaScript
syntax atomics.wait(typedarray, index, value[, timeout]) parameters typedarray a shared int32array.
... index the position in the typedarray to wait on.
... exceptions throws a typeerror, if typedarray is not a shared int32array.
... throws a rangeerror, if index is out of bounds in the typedarray.
JIT Optimization Outcomes
accessnottypedarray accessnotstring statictypedarrayuint32 statictypedarraycantcomputemask outofbounds getelemstringnotcached nonnativereceiver indextype setelemnondensenontanotcached nosimdjitsupport optimization failed because simd jit support was not enabled.
... icoptstub_genericsuccess icgetpropstub_readslot icgetpropstub_callgetter icgetpropstub_arraylength icgetpropstub_unboxedread icgetpropstub_unboxedreadexpando icgetpropstub_unboxedarraylength icgetpropstub_typedarraylength icgetpropstub_domproxyshadowed icgetpropstub_domproxyunshadowed icgetpropstub_genericproxy icgetpropstub_argumentslength icsetpropstub_slot icsetpropstub_genericproxy icsetpropstub_domproxyshadowed icsetpropstub_domproxyunshadowed icsetpropstub_callsetter icsetpropstub_addslot icsetpropstub_setunboxed icgetelemstub_readslot icgetelemstub_callgetter icgetelemstub_readunboxed i...
...cgetelemstub_dense icgetelemstub_densehole icgetelemstub_typedarray icgetelemstub_argselement icgetelemstub_argselementstrict icsetelemstub_dense icsetelemstub_typedarray icnamestub_readslot icnamestub_callgetter call inlining outcomes optimization outcomes of attempts to inline function calls.
Crypto.getRandomValues() - Web APIs
syntax typedarray = cryptoobj.getrandomvalues(typedarray); parameters typedarray an integer-based typedarray, that is an int8array, a uint8array, an int16array, a uint16array, an int32array, or a uint32array.
... return value the same array passed as typedarray but with its contents replaced with the newly generated random numbers.
... note that typedarray is modified in-place, and no copy is made.
TypeError: Reduce of empty array with no initial value - JavaScript
in javascript, there are several reduce functions: array.prototype.reduce(), array.prototype.reduceright() and typedarray.prototype.reduce(), typedarray.prototype.reduceright()).
...however, if no initial value is provided, it will use the first element of the array or typedarray as the initial value.
... examples invalid cases this problem appears frequently when combined with a filter (array.prototype.filter(), typedarray.prototype.filter()) which will remove all elements of the list.
JIT Optimization Strategies
getelem_typedarray attempts to optimize element accesses on a typed array.
... setelem_typedarray attempts to optimize element writes on a typed array.
JSProtoKey
32array jsproto_sharedfloat32array sharedfloat32array (nightly only) mxr search for jsproto_sharedfloat32array jsproto_sharedfloat64array sharedfloat64array (nightly only) mxr search for jsproto_sharedfloat64array jsproto_shareduint8clampedarray shareduint8clampedarray (nightly only) mxr search for jsproto_shareduint8clampedarray jsproto_typedarray typedarray added in spidermonkey 38 mxr search for jsproto_typedarray jsproto_atomics atomics (nightly only) mxr search for jsproto_atomics description each of these types corresponds to standard objects in javascript.
... see also bug 789635 bug 645416 - added jsproto_symbol bug 769872 - added jsproto_intl bug 792439 - added jsproto_weakset bug 896116 - added jsproto_typedarray bug 904701 - added jsproto_generatorfunction bug 914220 - added jsproto_typedobject bug 933001 - added jsproto_sharedarraybuffer bug 946042 - added jsproto_simd bug 1054882 - added jsproto_shared*arrays ...
Blob - Web APIs
WebAPIBlob
click the link to see the decoded object url.</p> javascript the main piece of this code for example purposes is the typedarraytourl() function, which creates a blob from the given typed array and returns an object url for it.
... function typedarraytourl(typedarray, mimetype) { return url.createobjecturl(new blob([typedarray.buffer], {type: mimetype})) } const bytes = new uint8array(59); for(let i = 0; i < 59; i++) { bytes[i] = 32 + i; } const url = typedarraytourl(bytes, 'text/plain'); const link = document.createelement('a'); link.href = url; link.innertext = 'open the array url'; document.body.appendchild(link); result click the link in the example to see the browser decode the object url.
Index - Web APIs
WebAPIIndex
98 arraybufferview api, interface, javascript, reference, typed arrays arraybufferview is a helper type representing any of the following javascript typedarray types: 99 attr api, dom the attr interface represents one of a dom element's attributes as an object.
... 379 buffersource api, interface, javascript, reference, typed arrays buffersource is a typedef used to represent objects that are either themselves an arraybuffer, or which are a typedarray providing an arraybufferview.
Indexed collections - JavaScript
this includes arrays and array-like constructs such as array objects and typedarray objects.
...s e.g., 1.123...15) unrestricted double double bigint64array -263 to 263-1 8 64-bit two's complement signed integer bigint int64_t (signed long long) biguint64array 0 to 264-1 8 64-bit unsigned integer bigint uint64_t (unsigned long long) for more information, see javascript typed arrays and the reference documentation for the different typedarray objects.
TypeError: 'x' is not iterable - JavaScript
the javascript exception "is not iterable" occurs when the value which is given as the right hand-side of for…of or as argument of a function such as promise.all or typedarray.from, is not an iterable object.
... the value which is given as the right hand-side of for…of or as argument of a function such as promise.all or typedarray.from, is not an iterable object.
Float32Array - JavaScript
examples different ways to create a float32array // from a length var float32 = new float32array(2); float32[0] = 42; console.log(float32[0]); // 42 console.log(float32.length); // 2 console.log(float32.bytes_per_element); // 4 // from an array var arr = new float32array([21,31]); console.log(arr[1]); // 31 // from another typedarray var x = new float32array([21, 31]); var y = new float32array(x); console.log(y[0]); // 21 // from an arraybuffer var buffer = new arraybuffer(16); var z = new float32array(buffer, 0, 4); // from an iterable var iterable = function*(){ yield* [1,2,3]; }(); var float32 = new float32array(iterable); // float32array[1, 2, 3] specifications specification ecmascript (ecma-262)the...
... definition of 'typedarray constructors' in that specification.
Float64Array - JavaScript
examples different ways to create a float64array // from a length var float64 = new float64array(2); float64[0] = 42; console.log(float64[0]); // 42 console.log(float64.length); // 2 console.log(float64.bytes_per_element); // 8 // from an array var arr = new float64array([21,31]); console.log(arr[1]); // 31 // from another typedarray var x = new float64array([21, 31]); var y = new float64array(x); console.log(y[0]); // 21 // from an arraybuffer var buffer = new arraybuffer(32); var z = new float64array(buffer, 0, 4); // from an iterable var iterable = function*(){ yield* [1,2,3]; }(); var float64 = new float64array(iterable); // float64array[1, 2, 3] specifications specification ecmascript (ecma-262)the...
... definition of 'typedarray constructors' in that specification.
Int16Array - JavaScript
examples different ways to create an int16array // from a length var int16 = new int16array(2); int16[0] = 42; console.log(int16[0]); // 42 console.log(int16.length); // 2 console.log(int16.bytes_per_element); // 2 // from an array var arr = new int16array([21,31]); console.log(arr[1]); // 31 // from another typedarray var x = new int16array([21, 31]); var y = new int16array(x); console.log(y[0]); // 21 // from an arraybuffer var buffer = new arraybuffer(8); var z = new int16array(buffer, 0, 4); // from an iterable var iterable = function*(){ yield* [1,2,3]; }(); var int16 = new int16array(iterable); // int16array[1, 2, 3] specifications specification ecmascript (ecma-262)the definition o...
...f 'typedarray constructors' in that specification.
Int32Array - JavaScript
examples different ways to create an int32array // from a length var int32 = new int32array(2); int32[0] = 42; console.log(int32[0]); // 42 console.log(int32.length); // 2 console.log(int32.bytes_per_element); // 4 // from an array var arr = new int32array([21,31]); console.log(arr[1]); // 31 // from another typedarray var x = new int32array([21, 31]); var y = new int32array(x); console.log(y[0]); // 21 // from an arraybuffer var buffer = new arraybuffer(16); var z = new int32array(buffer, 0, 4); // from an iterable var iterable = function*(){ yield* [1,2,3]; }(); var int32 = new int32array(iterable); // int32array[1, 2, 3] specifications specification ecmascript (ecma-262)the definition ...
...of 'typedarray constructors' in that specification.
Uint16Array - JavaScript
examples different ways to create a uint16array // from a length var uint16 = new uint16array(2); uint16[0] = 42; console.log(uint16[0]); // 42 console.log(uint16.length); // 2 console.log(uint16.bytes_per_element); // 2 // from an array var arr = new uint16array([21,31]); console.log(arr[1]); // 31 // from another typedarray var x = new uint16array([21, 31]); var y = new uint16array(x); console.log(y[0]); // 21 // from an arraybuffer var buffer = new arraybuffer(8); var z = new uint16array(buffer, 0, 4); // from an iterable var iterable = function*(){ yield* [1,2,3]; }(); var uint16 = new uint16array(iterable); // uint16array[1, 2, 3] specifications specification ecmascript (ecma-262)the defini...
...tion of 'typedarray constructors' in that specification.
Uint32Array - JavaScript
examples different ways to create a uint32array // from a length var uint32 = new uint32array(2); uint32[0] = 42; console.log(uint32[0]); // 42 console.log(uint32.length); // 2 console.log(uint32.bytes_per_element); // 4 // from an array var arr = new uint32array([21,31]); console.log(arr[1]); // 31 // from another typedarray var x = new uint32array([21, 31]); var y = new uint32array(x); console.log(y[0]); // 21 // from an arraybuffer var buffer = new arraybuffer(16); var z = new uint32array(buffer, 0, 4); // from an iterable var iterable = function*(){ yield* [1,2,3]; }(); var uint32 = new uint32array(iterable); // uint32array[1, 2, 3] specifications specification ecmascript (ecma-262)the defin...
...ition of 'typedarray constructors' in that specification.
Uint8Array - JavaScript
examples different ways to create a uint8array // from a length var uint8 = new uint8array(2); uint8[0] = 42; console.log(uint8[0]); // 42 console.log(uint8.length); // 2 console.log(uint8.bytes_per_element); // 1 // from an array var arr = new uint8array([21,31]); console.log(arr[1]); // 31 // from another typedarray var x = new uint8array([21, 31]); var y = new uint8array(x); console.log(y[0]); // 21 // from an arraybuffer var buffer = new arraybuffer(8); var z = new uint8array(buffer, 1, 4); // from an iterable var iterable = function*(){ yield* [1,2,3]; }(); var uint8 = new uint8array(iterable); // uint8array[1, 2, 3] specifications specification ecmascript (ecma-262)the definition o...
...f 'typedarray constructors' in that specification.
Uint8ClampedArray - JavaScript
examples different ways to create a uint8clampedarray // from a length var uintc8 = new uint8clampedarray(2); uintc8[0] = 42; uintc8[1] = 1337; console.log(uintc8[0]); // 42 console.log(uintc8[1]); // 255 (clamped) console.log(uintc8.length); // 2 console.log(uintc8.bytes_per_element); // 1 // from an array var arr = new uint8clampedarray([21,31]); console.log(arr[1]); // 31 // from another typedarray var x = new uint8clampedarray([21, 31]); var y = new uint8clampedarray(x); console.log(y[0]); // 21 // from an arraybuffer var buffer = new arraybuffer(8); var z = new uint8clampedarray(buffer, 1, 4); // from an iterable var iterable = function*(){ yield* [1,2,3]; }(); var uintc8 = new uint8clampedarray(iterable); // uint8clampedarray[1, 2, 3] specifications specification e...
...cmascript (ecma-262)the definition of 'typedarray constructors' in that specification.
for...of - JavaScript
the for...of statement creates a loop iterating over iterable objects, including: built-in string, array, array-like objects (e.g., arguments or nodelist), typedarray, map, set, and user-defined iterables.
... const iterable = [10, 20, 30]; for (let value of iterable) { value += 1; console.log(value); } // 11 // 21 // 31 iterating over a string const iterable = 'boo'; for (const value of iterable) { console.log(value); } // "b" // "o" // "o" iterating over a typedarray const iterable = new uint8array([0x00, 0xff]); for (const value of iterable) { console.log(value); } // 0 // 255 iterating over a map const iterable = new map([['a', 1], ['b', 2], ['c', 3]]); for (const entry of iterable) { console.log(entry); } // ['a', 1] // ['b', 2] // ['c', 3] for (const [key, value] of iterable) { console.log(value); } // 1 // 2 // 3 iterating over a set cons...
Index - Archive of obsolete content
2007 arraybuffer.transfer() arraybuffer, experimental, javascript, method, reference, typedarrays the static arraybuffer.transfer() method returns a new arraybuffer whose contents have been taken from the oldbuffer's data and then is either truncated or zero-extended by newbytelength.
ECMAScript 2016 to ES.Next support in Mozilla - Archive of obsolete content
ecmascript 2016 array.prototype.includes() (firefox 43) typedarray.prototype.includes() (firefox 43) exponentiation operator (firefox 52) ecmascript 2017 object.values() (firefox 47) object.entries() (firefox 47) string.prototype.padstart() (firefox 48) string.prototype.padend() (firefox 48) object.getownpropertydescriptors() (firefox 50) async functions async function (firefox 52) async function expression (firefox 52) asyncfunction (fire...
ECMAScript 2015 support in Mozilla - Archive of obsolete content
arraybuffer get arraybuffer[@@species] (firefox 48) dataview int8array uint8array uint8clampedarray int16array uint16array int32array uint32array float32array float64array get %typedarray%[@@species] (firefox 48) expressions and operators new.target (firefox 41) spread operator for arrays (firefox 16) use symbol.iterator property (firefox 36) spread operator for function calls (firefox 27) use symbol.iterator property (firefox 36) const (js 1.5, firefox 1.0) (es2015 compliance bug 950547 implemented in firefox 51) let (js 1.7, firefox 2) (es2015 comp...
Type conversion
onverted value ctypes.char.ptr js string pointer to temporary allocated null-terminated utf8 string ctypes.signed_char.ptr ctypes.unsigned_char.ptr ctypes.char16.ptr js string pointer to temporary allocated null-terminated utf16 string any pointer types any arraybuffer object pointer to the arraybuffer ctypes.voidptr_t any typedarray/dataview object pointer to the typedarray/dataview ctypes.char.ptr ctypes.int8_t.ptr int8array pointer to the int8array ctypes.uint8_t.ptr uint8array pointer to the uint8array uintclamped8array pointer to the uintclamped8array ctypes.int16_t.ptr int16array pointer to the int16array ctypes.uint16_t.ptr uint16array ...
Working with ArrayBuffers
the following codeblock provides a basic example of getting and setting uint8clampedarray and arraybuffer of imagedata: // context is a canvasrenderingcontext2d of some canvas var imagedata = context.getimagedata(x, y, w, h); var array = imagedata.data; // array is a uint8clampedarray var buffer = imagedata.data.buffer; // buffer is a arraybuffer // incomingbuffer is a typedarray var imagedata2 = context.createimagedata(w, h); imagedata2.data.set(incomingbuffer); further, if you have a byte array pixelbuffer, and you need to create imagedata from it.
AnalyserNode.frequencyBinCount - Web APIs
syntax var arraylength = analysernode.frequencybincount; value an unsigned integer, equal to the number of values that analysernode.getbytefrequencydata() and analysernode.getfloatfrequencydata() copy into the provided typedarray.
ArrayBufferView - Web APIs
arraybufferview is a helper type representing any of the following javascript typedarray types: int8array, uint8array, uint8clampedarray, int16array, uint16array, int32array, uint32array, float32array, float64array or dataview.
BufferSource - Web APIs
buffersource is a typedef used to represent objects that are either themselves an arraybuffer, or which are a typedarray providing an arraybufferview.
Crypto - Web APIs
WebAPICrypto
crypto.getrandomvalues() fills the passed typedarray with cryptographically sound random values.
SubtleCrypto.importKey() - Web APIs
keydata is an arraybuffer, a typedarray, a dataview, or a jsonwebkey object containing the key in the given format.
TextEncoder.prototype.encodeInto() - Web APIs
the solution is typedarray.prototype.subarray().
TextEncoder - Web APIs
however, in ie5-ie9, it will return a regular array instead of a typedarray.
USBDevice.controlTransferOut() - Web APIs
data a typedarray containing the data that will be transfered to the device.
USBDevice.isochronousTransferOut() - Web APIs
data a typedarray containing the data to send to the device.
USBDevice.transferOut() - Web APIs
data a typedarray containing the data to send to the device.
Equality comparisons and sameness - JavaScript
there are four equality algorithms in es2015: abstract equality comparison (==) strict equality comparison (===): used by array.prototype.indexof, array.prototype.lastindexof, and case-matching samevaluezero: used by %typedarray% and arraybuffer constructors, as well as map and set operations, and also string.prototype.includes and array.prototype.includes since es2016 samevalue: used in all other places javascript provides three different value-comparison operations: === - strict equality comparison ("strict equality", "identity", "triple equals") == - abstract equality comparison ("loose equality", "double equals") object.is provides samevalue (new in es2015).
Iterators and generators - JavaScript
te many times it[symbol.iterator] = function* () { yield 2; yield 1; }; user-defined iterables you can make your own iterables like this: const myiterable = { *[symbol.iterator]() { yield 1; yield 2; yield 3; } } for (let value of myiterable) { console.log(value); } // 1 // 2 // 3 or [...myiterable]; // [1, 2, 3] built-in iterables string, array, typedarray, map and set are all built-in iterables, because their prototype objects all have a symbol.iterator method.
TypeError: "x" is not a function - JavaScript
you will have to provide a function in order to have these methods working properly: when working with array or typedarray objects: array.prototype.every(), array.prototype.some(), array.prototype.foreach(), array.prototype.map(), array.prototype.filter(), array.prototype.reduce(), array.prototype.reduceright(), array.prototype.find() when working with map and set objects: map.prototype.foreach() and set.prototype.foreach() examples a typo in the function name in this case, which happens w...
TypeError: invalid arguments - JavaScript
var ta = new uint8array("nope"); // typeerror: invalid arguments different ways to create a valid uint8array: // from a length var uint8 = new uint8array(2); uint8[0] = 42; console.log(uint8[0]); // 42 console.log(uint8.length); // 2 console.log(uint8.bytes_per_element); // 1 // from an array var arr = new uint8array([21,31]); console.log(arr[1]); // 31 // from another typedarray var x = new uint8array([21, 31]); var y = new uint8array(x); console.log(y[0]); // 21 // from an arraybuffer var buffer = new arraybuffer(8); var z = new uint8array(buffer, 1, 4); // from an iterable var iterable = function*(){ yield* [1,2,3]; }(); var uint8 = new uint8array(iterable); // uint8array[1, 2, 3] ...
Array.prototype.copyWithin() - JavaScript
this especially applies to the typedarray method of the same name.
Array.isArray() - JavaScript
given a typedarray instance, false is always returned.
Atomics.isLockFree() - JavaScript
it returns true, if the given size is one of the bytes_per_element property of integer typedarray types.
BigInt64Array - JavaScript
examples different ways to create a bigint64array // from a length var bigint64 = new bigint64array(2); bigint64[0] = 42n; console.log(bigint64[0]); // 42n console.log(bigint64.length); // 2 console.log(bigint64.bytes_per_element); // 8 // from an array var arr = new bigint64array([21n,31n]); console.log(arr[1]); // 31n // from another typedarray var x = new bigint64array([21n, 31n]); var y = new bigint64array(x); console.log(y[0]); // 21n // from an arraybuffer var buffer = new arraybuffer(32); var z = new bigint64array(buffer, 0, 4); // from an iterable var iterable = function*(){ yield* [1n, 2n, 3n]; }(); var bigint64 = new bigint64array(iterable); // bigint64array[1n, 2n, 3n] specifications specification ecm...
BigUint64Array - JavaScript
examples different ways to create a biguint64array // from a length var biguint64 = new biguint64array(2); biguint64[0] = 42n; console.log(biguint64[0]); // 42n console.log(biguint64.length); // 2 console.log(biguint64.bytes_per_element); // 8 // from an array var arr = new biguint64array([21n,31n]); console.log(arr[1]); // 31n // from another typedarray var x = new biguint64array([21n, 31n]); var y = new biguint64array(x); console.log(y[0]); // 21n // from an arraybuffer var buffer = new arraybuffer(32); var z = new biguint64array(buffer, 0, 4); // from an iterable var iterable = function*(){ yield* [1n, 2n, 3n]; }(); var biguint64 = new biguint64array(iterable); // biguint64array[1n, 2n, 3n] specifications specification ...
Int8Array - JavaScript
examples different ways to create an int8array // from a length var int8 = new int8array(2); int8[0] = 42; console.log(int8[0]); // 42 console.log(int8.length); // 2 console.log(int8.bytes_per_element); // 1 // from an array var arr = new int8array([21,31]); console.log(arr[1]); // 31 // from another typedarray var x = new int8array([21, 31]); var y = new int8array(x); console.log(y[0]); // 21 // from an arraybuffer var buffer = new arraybuffer(8); var z = new int8array(buffer, 1, 4); // from an iterable var iterable = function*(){ yield* [1,2,3]; }(); var int8 = new int8array(iterable); // int8array[1, 2, 3] specifications specification ecmascript (ecma-262)the definition of 'typ...
JSON.stringify() - JavaScript
ke no sense in json let a = ['foo', 'bar']; a['baz'] = 'quux'; // a: [ 0: 'foo', 1: 'bar', baz: 'quux' ] json.stringify(a); // '["foo","bar"]' json.stringify({ x: [10, undefined, function(){}, symbol('')] }); // '{"x":[10,null,null,null]}' // standard data structures json.stringify([new set([1]), new map([[1, 2]]), new weakset([{a: 1}]), new weakmap([[{a: 1}, 2]])]); // '[{},{},{},{}]' // typedarray json.stringify([new int8array([1]), new int16array([1]), new int32array([1])]); // '[{"0":1},{"0":1},{"0":1}]' json.stringify([new uint8array([1]), new uint8clampedarray([1]), new uint16array([1]), new uint32array([1])]); // '[{"0":1},{"0":1},{"0":1},{"0":1}]' json.stringify([new float32array([1]), new float64array([1])]); // '[{"0":1},{"0":1}]' // tojson() json.stringify({ x: 5, y: 6, tojson(){...
Object.prototype.toLocaleString() - JavaScript
objects overriding tolocalestring array: array.prototype.tolocalestring() number: number.prototype.tolocalestring() date: date.prototype.tolocalestring() typedarray: typedarray.prototype.tolocalestring() bigint: bigint.prototype.tolocalestring() examples array tolocalestring() override on array objects, tolocalestring() can be used to print array values as a string, optionally with locale-specific identifiers (such as currency symbols) appended to them: for example: const testarray = [4, 7, 10]; let europrices = testarray.tolocalestring('fr', { style...
SharedArrayBuffer - JavaScript
the structured clone algorithm accepts sharedarraybuffers and typedarrays mapped onto sharedarraybuffers.
Symbol.iterator - JavaScript
the built-in types with a @@iterator method are: array.prototype[@@iterator]() typedarray.prototype[@@iterator]() string.prototype[@@iterator]() map.prototype[@@iterator]() set.prototype[@@iterator]() see also iteration protocols for more information.
Iteration protocols - JavaScript
{ value: 'bye', done: (this._first = false) } : { done: true } }, _first: true }; }; notice how redefining @@iterator affects the behavior of built-in constructs that use the iteration protocol: console.log([...somestring]); // ["bye"] console.log(somestring + ''); // "hi" iterable examples built-in iterables string, array, typedarray, map, and set are all built-in iterables, because each of their prototype objects implements an @@iterator method.
for await...of - JavaScript
the for await...of statement creates a loop iterating over async iterable objects as well as on sync iterables, including: built-in string, array, array-like objects (e.g., arguments or nodelist), typedarray, map, set, and user-defined async/sync iterables.
JavaScript typed arrays - JavaScript
let typedarray = new uint8array([1, 2, 3, 4]), normalarray = array.prototype.slice.call(typedarray); normalarray.length === 4; normalarray.constructor === array; specifications specification ecmascript (ecma-262)the definition of 'typedarray objects' in that specification.
Compiling an Existing C Module to WebAssembly - WebAssembly
code(p, image.width, image.height, 100); const resultpointer = api.get_result_pointer(); const resultsize = api.get_result_size(); const resultview = new uint8array(module.heap8.buffer, resultpointer, resultsize); const result = new uint8array(resultview); api.free_result(resultpointer); note: new uint8array(somebuffer) will create a new view onto the same memory chunk, while new uint8array(sometypedarray) will copy the data.