/JavaScript-Fundamentals

Java Script Fundamentals by travesy

Primary LanguageHTML

EASY TO REMEMBER NOTES

DOM SECTION

(a)Selectors

Main Modules(topics)
  (i)document.getElementById()
  (ii)document.getElementsByClassName()
  (iii)document.getElementsByTagName()
  (iv)document.querySelector()
  (v)document.querySelectorAll()
Important notes

(a)changing content and styles via these selectors

(b)Travesing

Parents and Children(
  and element inside a div is a child whereas div is a Parent.
  Elements at the same level and are both children are siblings
)
Querying Parents children and Siblings
Parent node(Parent is where a certain Node Element is contained)

(a)Parent Node
(b)Child Node
(c)Children
(d)NextSibling
(e)Previous Sibling
(f)Previous Element Sibling
(g)Inseriting into the DOM(Inserting Before)

Higer Order methods

(a)foreach
(b)filer
(c)Map
(d)Sort
(e)Reduce


all the higher order Methods can be combined together

ASTNCHRONOUSJAVASCRIPT

Asynchronous means something is going on but you do not want to wait until it is
done to conitunue your program
You exectue the call back within the main exection time when using callback functions.

You can pass a function as a parameter within another function.

Synchronous programming means you have to wait until a process is completely finished before you move on.

(a)Callbacks
(b)Promises
(c)Async Await
Promises take in two parameters which are resolve and reject ..

if resolve -> .then()

else error -> .catch()

Promise .all()  is used when you have many promises.

Promises take however long the execution time of the latest promises..

All the promies are handled within the major execution time to show us the values.


fetch api employs two .thens
Async await is a more elegant way to handle promises.

Conclusion

Mbugua Caleb...Wow.I Love Javascript
A "node", in this context, is simply an HTML element. The "DOM" is a tree structure that represents the HTML of the website, and every HTML element is a "node".