Notes for CodeSchool's Javascript Roadtrip

Here are my notes for Code School's Javascript Road Trip: http://javascript-roadtrip.codeschool.com

1 VALUES

math operators:
+ - * / % (remainder from division)

javascript follows standard order of for math operations
PEMDAS

comparators - return booleans
> < == != >= <=

strings
how javascript stores and processes flat text
"strings needs quotes"

concationation: +
"cat " + "man" = "cat man"
works with numbers and expresions

special characters
\t tab
\" quotes
\\ backslash
\n newline

string comparisons
== != case sensitive comarisons
.length "tim".length = 3

2 VARIABLES

var variable keyword
= assignment
var t = 3;

naming
no spaces
do'nt start numbers
underscores okay
shouldBeLike

once declared, variables can be reused
var t = 1;
t = t + 1;

updating variables
+= -= *=
t += 2

variables substitute their value in strings and expressions
"i saw " + t + " today"

increment and decrement
++ ––

both numbers and strings can be stored in variables
var name = "tim"
name.length => 3

character indexes
each character in a string has an index starting at 0
name.charAt(1) => "i"

3 FILES

embedding code
script tag

good idea to keep js files organized

semicolons are used to end statements for the compiler
var name = "tim";

printing from file to console
console.log("print this");

Comments

Post new comment

  • Allowed HTML tags: <em> <strong>
  • Lines and paragraphs break automatically.

More information about formatting options

Image CAPTCHA
Enter the characters shown in the image.