- allows you to find square root over Math.sqrt()
- reference: https://suhak.tistory.com/228
DOM(Document Object Model)
- other languages has DOM as well
- html code itself is not DOM but html code that you can open and manipulate in console log on browser is DOM
- represents HTML as a tree structure of tags.
- use ‘console.dir’ to show DOM
- the generic name for any type of object in the DOM hierarch
- one specific type of node and can be directly specified in the HTML with an HTML tag and can have properties like an id or class
- node > element
- inserts after the last child of the ParentNode.
- has no return value
- can append several nodes and strings
- put tag inside tag and tag will be moved with its node well, not clone. Only accepts Node objects
- only accepts
- returns the appended
- can only append one node.
- similar to append but it will insert before the first child node
- returns all the elements
- parentNode can be document and other tag as well as long as you call from html
- returns the first element
- only needs a reference to the child so making simpler to remove an element without having to look for the parent node
- needs a reference both to the parent and the child
- add class
- has security issue so better to use textContent
- reference: https://medium.com/@jenlindner22/the-risk-of-innerhtml-3981253fe217#:~:text=innerHTML%20today%20is%20cross%2Dsite,cookies%20and%20other%20personal%20information.