1
I want to see how it works. I create a function like this:
function $( selector ){
return document.querySelector( selector );
}
How do I create a function addClass()
to use just like jQuery $("#foo").addClass("bar")
, and in the future create a function chain like this: $("#foo").addClass("bar").setValue("value")
;
I make it clear that I don’t want to recreate jQuery, it’s just for learning.