CSS is the architectural plan, HTML is the house, Javascript is the wiring, and you are the architect, the builder, and the electrician. Without the wiring to link everything up, what good is that fancy new house? Your lights won't work when you flick the switch, your heatpump won't make the house nice and toasty while you drive home from a long day at work, and you can forget about snapping your fingers to dim the lights and fade in some Barry White. We generally take some of these things for granted because we can't see the wires or understand how they work, but without them we would just be a bunch of apes hurtling through space on a rock.
Typically code runs from top to bottom, but with things such as conditionals and loops we can alter this flow to fulfill our needs. We can do things like load the important things first on a page so that the end user isn't left hanging. There are a few different types of loops. One of the most common is a for loop. An example would be if I wanted to eat some biscuits. I would first need to check to see if I had biscuits. If I didn't, I would need to buy more biscuits, and if I did have biscuits I would then eat them all. If I then ran the loop again, I would have no biscuits and need to buy more, thus creating an infinite biscuit glitch. Sometimes you need to break a loop or it runs indefinitely and crashes the browser. A good way to break this cycle would be to create a rule that says if I'm full, stop eating biscuits.
The Document Object Model (DOM) represents the document as nodes and objects so that different programming languages can interact with the page without the need to change the code at the source. It gives us a neat way of quickly making changes and trying out ideas without the risk of messing up our code. This could be very useful for demonstrating some options for a client.
Arrays can be used to store a single value that can be accessed by specifying it's index number. Remember though, arrays start counting at 0.
For example,
let dogs = ['pug', 'shibaInu', 'hotdog'];
dogs[1]; shibaInu
Objects can be used to store a collection of data, rather than just a single value. You can access an object by using dot notation. You need to specify the object, then the name of the property. Don't forget to put a dot between the two.
For example,
let person = { name: 'Mike', age: 38 };
console.log(person.age);
Functions are blocks of code that perform specific tasks. A function can be declared by using the word "function" followed by the "name of the function", then a set of empty brackets. The body of the function then goes inside some curly brackets.
A function can be called by using the function name followed by a set of empty brackets and a semicolon.
For example,
function greet() { console.log("Hello there"); }
greet();