JSFiddle - React, Tailwind, and code Playground
HTML
<div class="parent"></div>
JavaScript
// create lots of children
var i = 0, par = $('.parent')[0], t = (new Date());
var child = $('<div class="child"/>')[0];
// Hugely faster than using jQuery to append nodes
while( i++ < 30000 ) {
par.appendChild(child.cloneNode(true));
}
t = (new Date()) - t;
console.log('generated in - ' + t);
document.writeln('<br>generated in - ' + t);
// get last using .last()
t = (new Date()), c = null;
c = $('.parent .child').last();
t = (new Date()) - t;
console.log('.last() - ' + t);
document.writeln('<br>.last() - ' + t);
// get last using :last
t = (new Date()), c = null;
c = $('.parent .child:last');
t = (new Date()) - t;
console.log(':last - ' + t);
document.writeln('<br>:last - ' + t);
// get last using qSA
t = (new Date()), c = null;
c = document.querySelectorAll('.parent .child');
c = c[c.length - 1]
t = (new Date()) - t;
console.log(':last - ' + t);
document.writeln('<br>:last - ' + t);