Adding internal JavaScript to HTML
<script type="text/javascript"> //JS code class="code" goes here </script>
Adding external JavaScript to HTML
<script src="filename.js"></script>
JavaScript Function syntax
function nameOfFunction(){
// function body
}
Changing content of a DOM Element
document.getElementById("elementID").innerHTML = "Hello World!";
Create a new element
document.createElement('div')
Create a new text node
document.createTextNode('some text here')
The browser creates a DOM (Document Object Model) whenever a web page is loaded, and with the help of HTML DOM, one can access and modify all the elements of the HTML document
Selector to select first matching element
document.querySelector('css-selectors')