Saved X
Google login
SignUp with Email
X

Javascript get the last item in an array

theindreshverma ( Edited  Sep 30, 03:14 pm )
Login

Javascript loop with length of array

<script>
var x = [0, 2, 4, 6, 8, 10];
var y;
for(i = 0; i < x.length; i++) {
    y = x[i];
}
document.write('Last array item - '+y);
</script>

Sourcecode Tags

More Sourcecodes

More Sourcecodes