reading-notes

These are my reading notes for Code Fellows


Project maintained by taegorov Hosted on GitHub Pages — Theme by mattgraham

Table of Contents

Home

Reading Day 1

Reading Day 2

Read04

Read05

Read06b

Read07

Read08

JavaScript & jQuery Pages 43-69 - Notes

HTML, CSS, and JavaScript - How they Work Together

<html> is the content layer

{css} is the presentation layer

javascript() is the behavior layer

Progressive Enhancement

All three of these layers work together to make a modern functioning website

Keeping things separate means that pages will still work if certain layers don’t load/run

Basics

Statements

A script is like a step-by-step instruction of how to tie your shoes (or any other set of instructions). Each step (e.g., “cross each lace”) is a statement.

Statements end with a ;

{ and } are the start and end of a code block.

Each statement starts on a new line

Comments

/* Type comments to yourself using this structure */

// you can use the double forward slash for single-line comments //

Like with HTML and CSS, these will help others understand your code better (and help you when you look back at your code months down the road)

Variables

These are just like variables in math or logic, which are “calculated or computed”

Declare a variable like so:

var quantity;

Assign a value to a variable like so:

quantity = 3;

Data Types

Other Notes

You can multiply/add/subtract/etc. variables using just their names, provided you have provided a value (see Data Types) to your variable

Variable Shorthand

There are many ways to de-clutter (or simplify) creating a variable. One option is shown below:

var price = 5;

instead of

var price;

price = 5;