Javascript BigInt64Array forEach()

Introduction

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

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

BigInt64Array.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 BigInt64Array([0n, 1n, 2n, 3n]).forEach(logArrayElements);



PreviousNext

Related