Click here to Skip to main content
15,897,518 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how to display the newest index of an array in javascript?
we enter multiple text in our textbox made in HTML,and that is stored
in array and we want those entered text to be displayed ,where newly entered has to be on top?
Posted
Comments
enhzflep 11-Apr-13 4:48am    
The newest item will be the one with the highest index.

var lastItem = arrayObj[ arrayObj.length - 1];
Matej Hlatky 11-Apr-13 5:06am    
Array Object has the length property, not size.
enhzflep 11-Apr-13 5:09am    
fixed. Thanks.
meshinator 11-Apr-13 5:12am    
can u please explain a bit? thank you in advance
enhzflep 11-Apr-13 5:24am    
Can I explain a bit about what?

1 solution

Try this:

var registeredElements = [];


// enter data in array


var LastArrayIndexValue = regManadatoryElements[regManadatoryElements.length];
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900