ngahine

HTML & CSS - What is the difference?

HTML is how you will begin the structural content of the document or web page, CSS is how you want to manipulate the display and design elements of the HTML. Think of post-it notes, HTML would be the information on the notes and the "wall" (webpage). CSS would be the arrangement, font, and appearance of the notes. Taking it a bit further you can use Javascript to make the post-it notes interactive for the user and provide different functions.

Control flow & Loops

A computer is always reading code from the top to bottom, this is how the control flow of Javascript works, looping is how you can manipulate this flow.

A real life example of this would be going to the fridge, is there food? If yes take food, if else there isn't you have two options, go to the supermarket or close fridge. Then repeat the first statement again.

Document Object Model (DOM)

Behind a webpage or HTML document there is a hierarchichal tree or nodes that holds all the different elements and objects. The DOM is a way to manipulate these elements by adding, removing and modifying parts of the document.

Objects vs Arrays

There are different ways you can access content on a webpage depending on the type of element it is. Objects are generally accessed through strings or symbols and arrays can be accessed by their index or the order they are in. Depending on the purpose of the task or data will determine which variable would be suitable.

With an object you would be accessing the data through the string or name.

        
          let cars = 
          {
            name: "Nissan",
            colour: "blue",
            year: "2014"
          }
        
With arrays you will be accessing the data through the order they are in, the index also starts at 0.
        
          let cars = 
          ['Nissan', 'Toyota', 'BMW']
    
        

Functions

As a developer you're going to want to perform many different task at the same time. Functions are used to make it easier to run scripts without repeating code over and over. You can use functions as a way to run complex tasks and calculations that you want to input and display with an output.

    
      function welcome() {
        console.log('Kia ora!');
    }
    
    welcome();