values()
method returns a new
Array Iterator
object that contains the values for each index in the array.
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.
arr.values()
A new
Array Iterator
对象。
for...of
loop
var arr = new Uint8Array([10, 20, 30, 40, 50]);
var eArray = arr.values();
// your browser must support for..of loop
// and let-scoped variables in for loops
for (let n of eArray) {
console.log(n);
}
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
| 规范 |
|---|
|
ECMAScript (ECMA-262)
The definition of '%TypedArray%.prototype.values()' in that specification. |
| Desktop | Mobile | Server | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
值
|
Chrome 38 | Edge 14 | Firefox 37 | IE No | Opera 25 | Safari 10 | WebView Android 38 | Chrome Android 38 | Firefox Android 37 | Opera Android 25 | Safari iOS 10 | Samsung Internet Android 3.0 | nodejs 0.12 |
完整支持
不支持
TypedArray
TypedArray.prototype.entries()
TypedArray.prototype.keys()
TypedArray.prototype[@@iterator]()
TypedArray
TypedArray.from()
TypedArray.of()
TypedArray.prototype.copyWithin()
TypedArray.prototype.entries()
TypedArray.prototype.every()
TypedArray.prototype.fill()
TypedArray.prototype.filter()
TypedArray.prototype.find()
TypedArray.prototype.findIndex()
TypedArray.prototype.forEach()
TypedArray.prototype.includes()
TypedArray.prototype.indexOf()
TypedArray.prototype.join()
TypedArray.prototype.keys()
TypedArray.prototype.lastIndexOf()
TypedArray.prototype.map()
TypedArray.prototype.reduce()
TypedArray.prototype.reduceRight()
TypedArray.prototype.reverse()
TypedArray.prototype.set()
TypedArray.prototype.slice()
TypedArray.prototype.some()
TypedArray.prototype.sort()
TypedArray.prototype.subarray()
TypedArray.prototype.toLocaleString()
TypedArray.prototype.toString()
TypedArray.prototype.values()
TypedArray.prototype[@@iterator]()
Int8Array
Uint8Array
Uint8ClampedArray
Int16Array
Uint16Array
Int32Array
Uint32Array
Float32Array
Float64Array
BigInt64Array
BigUint64Array
Function
Object
Object.prototype.__defineGetter__()
Object.prototype.__defineSetter__()
Object.prototype.__lookupGetter__()
Object.prototype.__lookupSetter__()
Object.prototype.hasOwnProperty()
Object.prototype.isPrototypeOf()
Object.prototype.propertyIsEnumerable()
Object.prototype.toLocaleString()
Object.prototype.toSource()
Object.prototype.toString()
Object.prototype.valueOf()
Object.setPrototypeOf()