Greetings!
I am starting the dive into Javascript, and I would like to share a little reference cheatsheet I am looking at as a quick reminder for some of the basics.
This post will hold very little conceptual significance and is more like a cheat-sheet for reference.
querySelector(); & querySelectorAll();
Called on a document object, this is used to select anything within that matches the parameters passed in the argument.
Searching by an ID can utilize the hashtag ex. querySelector("#exampleID");
Searching by a Class can utilize the period ex. querySelector(".exampleClass");
We can also call this to find any HTML elements ex. querySelector("h1");
findElementByID(); & findElementByClass();
Similar to above, these functions will find anything matching the parameters given. As the title of these suggest, these are less flexible than the above choices, but technically run faster (though negligibly so from what I could find on the internet)
ARRAYS:
Adding to one? UNSHIFT is at the beginning. PUSH is at the end.
Removing from one? SHIFT is at the beginning. POP is at the end.
Target:
This reminded me of params in Ruby. We call Target on events that we listen for- Once an event takes places, we can look at event.target to find a lot of attributes that we can play with. So far, we have only used this to pull out user to input, but given the list of attributes within target, I think that its flexibility is far grander than I can imagine.
I WILL UPDATE THIS AS I LEARN MORE! :)
Top comments (0)