[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/forEach [Back]  [Original]

TypedArray.prototype.forEach() - JavaScript | MDN

MDN Web Docs

View in English Always switch to English

TypedArray.prototype.forEach()

20169

forEach() Array.prototype.forEach() TypedArray

js
forEach(callbackFn)
forEach(callbackFn, thisArg)

callback

currentValue

index

array

forEach()

thisArg

callbackthis

undefined.

forEach callbackundefined

callback

  • the
  • the
  • the

thisArg forEach callback this undefined this callback this this

forEachcallback forEach callbackcallbackforEach

forEach()callback every() some() undefined

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

new Uint8Array([0, 1, 2, 3]).forEach(logArrayElements);
// 
// a[0] = 0
// a[1] = 1
// a[2] = 2
// a[3] = 3

ECMAScript 2027 LanguageSpecification
# sec-%typedarray%.prototype.foreach


Web Proxy Viewer  |  New URL  |  Original Page