HTML : A Markup Language.
* Markup languages are for writing formatted documents.
CSS : A Styling Language.
* A styling language modifies the way HTML documents look.
Javascript (JS abbreviated) : A programming language.
* The main programming language on websites.
* Entirely different from Java. (confusing)
html tag
* where the body, script, and style tags go inside
body tag
* for text, images, inputs, buttons
script tag
* script tags are for writing javascript code
* can modify anything! body, style (and more).
style tag
* for setting format of things in the body
Line 1 : a function named add is being defined with two inputs.
Line 2 : a variable answer is made and set to the sum of the two inputs.
Line 3 : answer is outputted from the function by the return statement.
Line 4 : the function is closed with a curly brace.
Line 5 : the add function is called on 3 and 5, and a new variable x is set to the output.
Line 6 : the value of x is outputted to the console => 8
an array is a list of variables
A[i] gets the ith variable in A
arrays are zero indexed, meaning the first element is a[0], not a[1]
example
var cars = ["toyota","ford","chevy"]
var car = cars[0]
car is equal to "toyota"
car = cars[2]
now car is equal to "chevy"
for loops can repeatedly run a segment of code
example
for(var i=0;i<5;i++){
console.log(i);
}
/* this line of code will run 5 times, and will print to the
console
0
1
2
3
4
e.getElementsByClassName(c) returns an array
it returns an array of all elements inside element e with a class of c
document.getElementByClassName(c) returns the array of elements with class of c in the whole document