JavaScript values() 方法用於定義數組中內容的值。
用法:
array.values()
參數:
沒有參數
返回值:
index 值
瀏覽器支持:
Chrome | Yes |
Safari | Yes |
Firefox | Yes |
Opera | Yes |
例子1
JavaScript TypedArray values() 方法。
<script>
//JavaScript to illustrate types() method
var A = new Uint8Array([ 1,3,4,5,6,7,8,9 ]);
// Calling array.values() method
var JavaTpoint = A.values();
// Printing value of index 0
document.write(JavaTpoint.next().value);
// expected output:1
</script>
輸出:
1
例子2
JavaScript TypedArray values() 方法。
<script>
//JavaScript to illustrate types() method
var A = new Uint8Array([ 1,3,4,5,6,7,8,9 ]);
// Calling array.values() method
var JavaTpoint = A.values();
// shift index to the 1
JavaTpoint.next();
// Printing the value of index 1
document.write(JavaTpoint.next().value);
// expected output:3
</script>
輸出:
3
例子3
JavaScript TypedArray values() 方法。
<script>
//JavaScript to illustrate types() method
var A = new Uint8Array([ 1,3,4,5,6,7,8,9 ]);
// Calling array.values() method
var JavaTpoint = A.values();
JavaTpoint.next()
JavaTpoint.next()
JavaTpoint.next()
JavaTpoint.next()
JavaTpoint.next()
JavaTpoint.next()
JavaTpoint.next()
JavaTpoint.next()
document.write(JavaTpoint.next().value);
// expected output:undefined
</script>
輸出:
Undefined
相關用法
- JavaScript TypedArray reverse()用法及代碼示例
- JavaScript TypedArray map()用法及代碼示例
- JavaScript TypedArray every()用法及代碼示例
- JavaScript TypedArray filter()用法及代碼示例
- JavaScript TypedArray indexOf()用法及代碼示例
- JavaScript TypedArray find()用法及代碼示例
- JavaScript TypedArray keys()用法及代碼示例
- JavaScript TypedArray entries()用法及代碼示例
- JavaScript TypedArray join()用法及代碼示例
- JavaScript TypedArray toString()用法及代碼示例
- JavaScript TypedArray set()用法及代碼示例
- JavaScript TypedArray sort()用法及代碼示例
- JavaScript TypedArray some()用法及代碼示例
- JavaScript TypedArray slice()用法及代碼示例
- JavaScript TypedArray subarray()用法及代碼示例
- JavaScript TypedArray toLocaleString()用法及代碼示例
- JavaScript TypedArray reduce()用法及代碼示例
- JavaScript TypedArray fill()用法及代碼示例
- JavaScript TypedArray includes()用法及代碼示例
- JavaScript TypedArray copyWithin()用法及代碼示例
注:本文由純淨天空篩選整理自 JavaScript TypedArray values() Method。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。