⬅ Return to Home | Ash Rockett | 2022

Technical JavaScript Blog –
Sprint Three

An analogy to describe JavaScript and its relationship to HTML and CSS.

HTML, CSS and JAVASCRIPT are like various pieces of a house. HTML being the structure and foundation. CSS being the decoration and style of the house’s interior and exterior. JAVASCRIPT is like the inner workings of the house, all of the wiring, the moving parts such as lightswitches, doorbells, TV remotes or alarm systems and so on. Basically, your house might be big and look lovely, but without the functionality to make the lights go on, the water run from the tap, the heating coming on at night, its basically a nice looking hollow shell.

Explain control flow and loops using an example process from everyday life, for example, 'waking up' or 'brushing your teeth' (but not those).

By default, our code is executed top to bottom, line by line. We can however, change this using control flow. Control flow allows the program to make decisions about what code is executed and when. Loop statements are the primary mechanism for telling a computer to perform the same task over and over again until a set of criteria are met. Making a sandwich:



Describe what the DOM is and an example of how you might interact with it.

DOM stands for Document Object Model. Essentially the document is referring to the HTML page itself. The object refers to the pieces on the page, or document, that can be manipulated through Javascript. It's sort of like an upside down tree, not unlike a family tree, always starting with the document, then passing down through to all the parent and children elements.


Explain the difference between accessing data from arrays and objects.

Objects and arrays are similar in a way, but objects can hold more information about each key it holds. Objects essentially hold things while arrays are just numerical values. Here is an example of extracting information from an object.


Explain what functions are and why they are helpful.

Functions can be anything! Typically they are a set of instructions that define a section of your code, usually made up of various methods that perform certain tasks throughout your code. They are helpful because functions can call/execute eachother, they can be used or referred to multiple times once written which means we don’t have to repeat ourselves.