Array's lastIndexOf returns -1 when start is undefined
javascript
Solution
array.lastIndexOf(searchElement[, fromIndex])
fromIndex The index at which to start searching backwards. Defaults to the array's length, i.e. the whole array will be searched. If the index is greater than or equal to the length of the array, the whole array will be searched. If negative, it is taken as the offset from the end of the array. Note that even when the index is negative, the array is still searched from back to front. If the calculated index is less than 0, -1 is returned, i.e. the array will not be searched.
`[1,2,3].lastIndexOf(2,undefined)` is same as `[1,2,3].lastIndexOf(2, 0)`, so only the first element will be searched.
`[1,2,3].lastIndexOf(2, 0)` will return `-1`.
`[1,2,3].lastIndexOf(1, 0)` will return `0`.
Problem
in javascript,Array instance has two methods, ``` [].indexOf(searchvalue [,start]) ``` and ``` [].lastIndexOf(searchvalue [,start]) ``` is behaves strange if the "start" param is undefined: ``` [1,2,3].lastIndexOf(2) // 1 [1,2,3].lastIndexOf(2,undefined) // -1 [1,2,3].indexOf(2,undefined) // 1 ``` this happens in chrome and firefox,so what's the theory of the indexOf and lastIndexOf treat "undefined" differently