Here is my JavaScript code so far:
var linkElement = document.getElementById(\"BackButton\"); var loc_array = document.location.href.split(\'/\'); var newT =
You can use this pattern...
let [last] = arr.slice(-1);
While it reads rather nicely, keep in mind it creates a new array so it's less efficient than other solutions but it'll almost never be the performance bottleneck of your application.