Here is my JavaScript code so far:
var linkElement = document.getElementById(\"BackButton\"); var loc_array = document.location.href.split(\'/\'); var newT =
The "cleanest" ES6 way (IMO) would be:
const foo = [1,2,3,4]; const bar = [...foo].pop();
This avoids mutating foo, as .pop() would had, if we didn't used the spread operator. That said, I like aswell the foo.slice(-1)[0] solution.
foo
.pop()
foo.slice(-1)[0]