The Full JavaScript & ES6 Course Notes : Adding JS to HTMLDOM

Download node to run our JS

check on the terminal for the latest version of node and npm

What is Javascript?

  • Javascript is a small lightweight, object-oriented scripting language connects to objects in host environments and control them. The host environment is most commonly a web browser. We call this client side javascript.
  • JS on the client side : we access the DOM(document object model) in order to handle user interaction.
  • JS on the server side : uses JS language to run servers and communicates databases.

You don’t need to keep track of whether variables are public private protected etc.. These minimal requirements for javascript make the language so small and lightweight.

The reason javascript is also called ECMA. So whenever they release an official version of the language, we can refer to that version as ES or ECMAScript and 6 and the version number.

Adding JS to HTML



Install live-server

could use local host:3000 to check the index.html

Open an index.js file and in Index.html:


console.log("hello from other file");

console shows “hello from other file”


The most frequently used one is getElementById. We use that function to find that div with the idea of example that we created in our index.html. Then we explicitly change its inner to javascript string that we specify.

document.getElementById('example').innerHTML='javascript rules'