Sam's Blog

Home
Core: Learning Agreement
Technical Blog: Positioning
Core: My Identity
Technical Blog: HTML & CSS
Core: Emotional Intelligence
Technical Blog: Problem Solving
Cultural Blog: Growth Mindset
Core: Reflections

Technical Blog

HTML and CSS

HTML Defines the structure and content of a web page while CSS modifies the appearance and styling the page. It can be described like building a car. The html is the basic structure of the car - the chassis, wheels and general parts. The css is the styling. The colour, the body shape, the interior styling. Combining these two aspects makes a much more comprehensive product.

Control Flow and Loops

JavaScript code is generally executed in the order the objects are listed. This is the natural flow of the program. Control flow can alter the order things are executed such as applying loops until a certain condition is met. If Eating food was a program it would probably take the following steps:

  1. Put food in mouth
  2. Chew food
  3. Swallow
  4. Repeat.
When is the food ready to be swallowed? The looping would come in at the chewing.

Chew food. → Food soft enough to swallow = false. → Repeat Chew. → Food soft enough to swallow = true. → Swallow food.

The last step is not executed until food is soft enough to swallow.

The DOM

The DOM is the browser’s internal representation of the web page. It takes the elements of the document and lays it out in a tree model and is where the html, css and JavaScript interact. JavaScript can modify and add elements to html. This will not be reflected in the html source but will be reflected in the DOM.

Arrays and Objects

Arrays store multiple types of the same data and assign each item a number starting from 0. To access an item in an array you would type the array name followed by the item number you need. The number is enclosed by square brackets. Eg - arrayName[4] would give you the 5th item of information of arrayName. Objects can store multiple types of information and store them as properties. To access them you would type objectName.propertyName

Functions

In JavaScript, a function is a set of statements (code) that performs a task. When a function is executed it will perform the task it is given. Functions can be called on when needed or run multiple times. Functions help keep code tidy and don’t need to be rewritten every time a task is needed to be run.