Javascript Basics

How does Javascript compare to HTML and CSS?

It feels more complex for sure! loops and syntax do my head in. camelCode format took little to get used to.


Explain control flow and loops using an example process from everyday life, for example 'waking up' or 'brushing your teeth’.

Control flow is the process by which decisions and actions are carried out in the code, and in what order.

You wouldn’t brush your teeth before waking up in the morning would you? You would also keep brushing, until each tooth has been brushed (hopefully).

Control statements determine the control and flow of processes the code is calling.


Explain the difference between accessing data from arrays and object literals.

Accessing data from arrays is done with square bracket notation, where the item of data is located within the array by its’ position in the array: for example, the second item in myArray would be called => myArray[1].

Accessing data from object literals is done by using dot notation: for an myObject {“shoe”: “boot”}, you could use myObject.shoe, this would return “boot”; or you could use square bracket notation like this: myObject[“shoe”] to return the same.


Explain what functions are and why they are useful

Functions save us time by using code that can be used repeatedly, using different inputs and parameters.