Javascript Float64Array forEach()

Introduction

The Javascript Float64Array forEach() method executes a provided function on each array element.

This method works the same as Array.prototype.forEach().

Float64Array.forEach(callback[, thisArg])
Parameter
Optional
Meaning
callback




Required




Function that produces an element of the new typed array,
Taking three arguments:
currentValue - the current element being processed.
index - the index of the current element.
array - the array itself.
thisArg
Optional
Value to use as this when executing callback.

The following code logs a line for each element in a typed array:

function logArrayElements(element, index, array) {
  console.log('a[' + index + '] = ' + element);
}

new Float64Array([0, 1, 2, 3]).forEach(logArrayElements);



PreviousNext

Related