JavaScript Notes 2

Loops

  • For loop

  • while loop

  • do while loop

Arrays

Data structure that can hold multiple data values in one variable.

Methods:

arr.length

arr.push();

arr.filter( () => {}) it returns a new array

arr.map( () => {})

Objects

Used to store multiple properties in one variable.

DOM

The DOM allows you to access and change the styling and content of element on your website.

// First way of accessing element

document.querySelector('#id');

// Second way of accessing element

document.getElementById('title');