I prefer:-
function $(q, parent) { return (parent || document).querySelector(q); } function $(q, parent) { return (parent || document).querySelector(q); } function $(q, parent) {
parent = parent || document;
return [].slice.call(parent.querySelectorAll(q));
} Array.from(<NodeList or other iterable>)
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...