JavaScript: The Definitive Guide, Sixth Editio javaScript权威指南(第6版) pdf 文字版-文字版, javascript电子书, 和javascript 有关的电子书:

Array.lastIndexOf()

Array.lastIndexOf()ECMAScript 5

search backward through an array

Synopsis

array.lastIndexOf(value) array.lastIndexOf(value, start)

Arguments

value The value to search array for.

start

An optional array index at which to begin the search. If omitted, the search begins with the last element of the array.

Returns

The highest index <= start of array at which the element is === to value, or -1 if no such matching element exists.

Description

This method searches backward through successively lower elements of array for an element that is equal to value, and returns the index of the first such element it finds. If start is specified, it is used as the starting position for the search; otherwise the search begins at the end of the array. The ===operator is used to test equality. The return value is the index of the first matching element found, or -1 if no match is found.

See Also

Array.indexOf() , String.lastIndexOf()

Array.length

the size of an array

Synopsis

array.length

Core JavaScript Reference | 729

Array.map()

Description

The length property of an array is always one larger than the index of the highest element defined in the array. For traditional “dense” arrays that have contiguous elements and begin with element 0, the length property specifies the number of elements in the array.

The length property of an array is initialized when the array is created with the Array() constructor method. Adding new elements to an array updates the length, if necessary:

a = new Array(); // a.length initialized to 0

b = new Array(10); // b.length initialized to 10

c = new Array("one", "two", "three"); // c.length initialized to 3

c[3] = "four"; // c.length updated to 4

c[10] = "blastoff"; // c.length becomes 11

欢迎转载,转载请注明来自一手册:http://yishouce.com/book/1/28137.html
友情链接It题库(ittiku.com)| 版权归yishouce.com所有| 友链等可联系 admin#yishouce.com|粤ICP备16001685号-1