How does JavaScript function

Hello and welcome back,

Let’s go back to our paintings. We, together, must make a work of art because that’s how the browser and the developer are working together. The browser is very good at drawing and the developer is the one providing the instructions. See, teamwork! You are the browser, I am the developer.

So, we should paint on wood. But I am not that good, I am learning. You, the artist are good but you cannot pick your own colours.

  1. I accept all the colours that I find because I don’t know anything about them.
  2. I must read all the paint labels and pick the one that is fit for wood.
  3. Mix the paint with oil as stated on the label.
  4. Now that I have sorted the colours for wood I must look at the labels and pick the desired colour.

That’s about how the browser and JavaScript works.

  1. First the browser accepts the file because it trust us.
  2. Reads the file. This step also ensures that our file is correct and can be run (note#1)
  3. Executes all the code that does not belong to a specific function (note#2)
  4. Creates a list of actions that must be executed in order for every element that it is targeted.

Tomorrow we will learn about pointing JavaScript to our HTML elements.

Gabi

Leave a Reply

Your email address will not be published. Required fields are marked *