javascript last index of is the same as indexof code example
Example 1: get all the child of the same class javascript
var doc = document.getElementById("test");
var notes = null;
for (var i = 0; i < doc.childNodes.length; i++) {
if (doc.childNodes[i].className == "4") {
notes = doc.childNodes[i];
break;
}
}
Example 2: array index javascript show only first 2 elements
array.slice(0, n);