Javascript is just one of the multiple layers which build a webpage, the other layer in most cases is HTML and CSS and together they are progressive enhancement in page building.
Javascript is written in plain text like HTML and CSS.
-JS files can live in folders js., scripts or javascript
document = represents the entire webpage write(‘message here’) = the content can be written on the page where script element is
Statements are individual instructions which make up a script ending with ;
green is the statement
pink indicate start & end of the codeblock
purple determines which code should run
Comments describe for you and others what the code does
green JS code
pink multiple lines of comments
gray single line of comments
Variables are where a scripts data is stored. Data within variables can ‘calculate’ or ‘compute’ numbers or other types of data.
declaring a variable = var quantity = 1;
numeric data = 0.45
string type data = ‘what is up!’
BOOLEAN data = true or false
Variables can store strings which are placed inside of either single or double quotes
if using single quotes in the string, surround the entire string and the single quotes with double quotes OR the other way around
Must begin with a letter $ or _ - no numbers!
Name can contain the same as above but no - or .
No keywords or eserved words (words to be used in the future)
Variables are case sensitive!
use a name that describes the information example: myName
If name is made of more than one word, separate with an uppercase letter after first word as shown above