This is a question about the code below.
The code works to give the result wanted. However, I would like to know if it is really a proper code written correctly or just a fluke it worked.
The need of the code that was being worked on was to show just the last item in an array list from an external source which appears below as the list array input field, with various words and forward slashes just as shown.
While putting the code together it was tested and unexpectedly showed the wanted result.
The List Array <input id="externalarraylist" size="50" value="Tree/House/Train/Block/DVD/CD/Jewelry/Road">
The last item <input id="show_only_Last_one" size="10" value="">
var findlast = document.getElementById("externalarraylist").value.split('/');
for ( i=0; i < findlast.length; i++ )
<button onclick="DisplayLastOne()">See Last One</button>