reading-notes

Reading Notes Home

JAVASCRIPT Reading Notes

Duckett: Duckett: JS&JQuery PGS 43-69

What is Javascript?

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.

Creating Javascript

Javascript is written in plain text like HTML and CSS.

-JS files can live in folders js., scripts or javascript

Objects and Methods

document = represents the entire webpage write(‘message here’) = the content can be written on the page where script element is

JS Basics

Statements are individual instructions which make up a script ending with ;

Comments describe for you and others what the code does

Variables

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

Naming Variables

  1. Must begin with a letter $ or _ - no numbers!

  2. Name can contain the same as above but no - or .

  3. No keywords or eserved words (words to be used in the future)

  4. Variables are case sensitive!

  5. use a name that describes the information example: myName

  6. If name is made of more than one word, separate with an uppercase letter after first word as shown above