The last element that was found in the array, or ''null'' if the array was empty.
Notes:
* The usefulness of this method is rather limited, as it can be replaced by ''Array[Array.length-1]'', or ''Array.at[-1]''. Its main purpose is to provide an alternative syntax, which may – at least in some circumstances – result in more //readable// code.
===== Example =====
A simple example could look like this:
let foo = document.getElementsByTagName('foo');
let bar = foo.last();
if (bar) {
…
}
===== See also =====
* [[toolbox:arrays:first:index|.last()]]
===== More information =====
* [[mdn>Web/JavaScript/Reference/Global_Objects/Array/length|Array: length]] on MDN.
* [[mdn>Web/JavaScript/Reference/Global_Objects/Array/at|Array.prototype.at()]] on MDN.