Here is my JavaScript code so far:
var linkElement = document.getElementById(\"BackButton\");
var loc_array = document.location.href.split(\'/\');
var newT =
EDITED:
Recently I came up with one more solution which I now think is the best for my needs:
function w(anArray) {
return {
last() {
return anArray [anArray.length - 1];
};
};
}
With the above definition in effect I can now say:
let last = w ([1,2,3]).last();
console.log(last) ; // -> 3
The name "w" stands for "wrapper". You can see how you could easily add more methods besides 'last()' to this wrapper.
I say "best for my needs", because this allows me to easily add other such "helper methods" to any JavaScript built-in type. What comes to mind are the car() and cdr() of Lisp for instance.