A Journey into the Abyss of Code

...follow the pink brick road...

❤ BLOGS HOME ❤ ❤ ABOUT ME ❤



JavaScript Basics


How does JavaScript compare to HTML and CSS?

Javascript is a lot more functional with its commands and what it can do. While HTML and CSS structures a webpage and makes it look nice with coordinating colours and fonts, JavaScript is what adds the “bells and whistles” as they say and makes the page more interactive.


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

Control flow refers to the structure that code is written in. This is very important, because the code will be read and executed from top down, so if the order of your code is not correct it can return different values.

An example is if/else statements, they go in the order that if a condition is met then it returns a certain value or else it will return another. To illustrate, let’s say you want to make a purchase, if your credit card has enough money then the sale will be accepted, or else it will be rejected.

A loop is a code that will continue running (looping) for a specified amount of times or until a contain is met. Simple example, let’s say you have an outstanding amount owing on a hire purchase and it’s paid weekly. A loop of the weekly payment will run until the condition of full payment is met.


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

Arrays are like matrixes in maths and you access them by their position, starting from 0,1,2.. they can also be nested and have multi levels. They are much more structured than objects which can be accessed in any order. You access an object by referring to it while you access a value in an array by referring to it’s position.


Explain what functions are and why they are useful.

Functions are a set of code that can be called upon and used repeatedly. This saves time from having to write the same code out again and again.