This is my take on it. It checks whether I'm asking for an id or not, and if I am, it returns just that one element. If not, the NodeList is made into an array.
const$=(q,d=document)=>/#\S+$/.test(q)// check if query asks for ID?d.querySelector.bind(d)(q)// if so, return one element:[...d.querySelectorAll.bind(d)(q)]// else, return all elements in an array.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
This is my take on it. It checks whether I'm asking for an id or not, and if I am, it returns just that one element. If not, the NodeList is made into an array.