values() 메서드는 배열의 각 인덱스에 대한 값을 가지는 새로운 Array Iterator 객체를 반환합니다.
구문
arr.values()
반환 값
새로운 Array 반복기 객체.
예제
for...of 루프를 통한 반복
var arr = ['w', 'y', 'k', 'o', 'p'];
var eArr = arr.values();
// your browser must support for..of loop
// and let-scoped variables in for loops
for (let letter of eArr) {
console.log(letter);
}
다른 반복법
var arr = ['w', 'y', 'k', 'o', 'p']; var eArr = arr.values(); console.log(eArr.next().value); // w console.log(eArr.next().value); // y console.log(eArr.next().value); // k console.log(eArr.next().value); // o console.log(eArr.next().value); // p
명세
| 명세 | 상태 | 비고 |
|---|---|---|
| ECMAScript 2015 (6th Edition, ECMA-262) The definition of 'Array.prototype.values' in that specification. |
Standard | Initial definition. |
| ECMAScript (ECMA-262) The definition of 'Array.prototype.values' in that specification. |
Living Standard |
브라우저 호환성
Update compatibility data on GitHub
| Desktop | Mobile | Server | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
values | Chrome Full support 66 | Edge Full support 12 | Firefox Full support 60 | IE No support No | Opera Full support 53 | Safari Full support 9 | WebView Android Full support 66 | Chrome Android Full support 66 | Firefox Android Full support 60 | Opera Android Full support 47 | Safari iOS Full support 9 | Samsung Internet Android Full support 9.0 | nodejs
Full support
10.9.0
|
Legend
- Full support
- Full support
- No support
- No support
- See implementation notes.
- See implementation notes.
- User must explicitly enable this feature.
- User must explicitly enable this feature.