javascript - last index array without loop -


good morning/afternoon

i want create object whitch simulate array, new browsers no pb change proto of array mine oldest version of ie need know length of false array finding last index. have found way ie:

var getlastpos = function(){     for( var in falsearray){        //do nothing     }     return  } 

but if faster way exists, rather like. try pass regex lastindexof seems don't work thanks.

when want find last index array, use

<array>.length  

so not need loop, , function, use

falsearray.length 

if need value last position use this:

falsearray[falsearray.length-1]  //decrement one, because index array starts 0 

i hope helpful.


Comments

Popular posts from this blog

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - UML - How would you draw a try catch in a sequence diagram? -

c++ - No viable overloaded operator for references a map -