programming language used to create and control dynamic website content i.e. anything that moves, refreshes, or otherwise changes on your screen without requiring you to manually reload a web page
Variables
a name of storage location. the actual value of a variable can be changed at any time
Primitive Data Types
String
number
boolean
undefined
null
symbol
bigint
Non-Primitive Data Types
object
array
string data type
const name ="js string";
number data type
const num = 20;
boolean data type
const t = true;
const f = false;
undefined data type
let u;
const t = undefined;
const u = null;
symbol data type
const a = symbol("a");
const b= symbol("a");
console.log(a===b); // false
object data type
let myObj = {
"height-cm": 175,
"weight-lbs": 275,
"distance-km": 7
};
array data type
// array with the same data type
let food = ["pizza", "burgers", "fries", "cake"]
// array with different data types
let order = [25, "burgers", 50.99, true];
document object model
also known as DOM, allows java to remove existing HTML elements and attributes, modify CSS properties, react to all existing HTML events on the page
document.getElementbyID();
JavaScript can access HTML and CSS through: ID
document.getElementsByClassName();
JavaScript can access HTML and CSS through: Class
document.getElementsByTagName();
JavaScript can access HTML and CSS through: Tag Name (<div>, <p>, <a>)
document.querySelector();
JavaScript can access HTML and CSS through: CSS Selectors
document.getElementsByName();
JavaScript can access HTML and CSS through: Name Attribute