JavaScript中的TypedArray.lastIndexOf()函数
TypedArray对象的lastIndexOf()函数接受一个值并验证类型数组是否包含指定的元素。如果是这样,则此函数返回找到指定元素的数组的索引,如果该元素多次出现,则此函数返回其中的最后一个索引。如果数组不包含指定的元素,则indexOf()函数将返回-1。
语法
它的语法如下
typedArray.lastIndexOf(50)
示例
<html>
<head>
<title>JavaScript Array every Method</title>
</head>
<body>
<script type="text/javascript">
var int32View = new Int32Array([21, 19, 65, 21, 14, 66, 87, 55, 66, 97, 66 ]);
document.write("Contents of the typed array: "+int32View);
document.write("<br>");
var contains = int32View.lastIndexOf(66);
document.write("Specified element occurred at the index: "+contains);
</script>
</body>
</html>输出结果
Contents of the typed array: 21,19,65,21,14,66,87,55,66,97,66 Specified element occurred at the index: 10
热门推荐
1 训练狗狗基础
2 怎么训练狗狗笑
3 怎么训练狗狗卧下
4 上海狗狗训练基地
5 训练狗狗排便
6 狗狗基础训练
8 如何训练狗狗装死
9 狗狗站姿训练
10 狗狗训练用品
11 训练狗狗吧
12 狗狗要怎么训练
13 怎么训练狗狗玩球
14 训练狗狗唤回
15 狗狗训练躺下
16 狗狗训练指令
17 狗狗的训练技巧
18 狗狗不好训练