document.querySelectorAll('head > link[rel="stylesheet"]')[this.length-1];
this.length-1
? Depending on the calling context you have in this can be anything. If there is a window (window.length-1) == -1, and the element with index -1 in the array can not be.let stylesheets = document.querySelectorAll('head > link[rel="stylesheet"]')
let last = Array.from(stylesheets).pop()
// or
let last = [...stylesheets].pop()
Find more questions by tags JavaScript