Press key to advance. Zoom in/out: Ctrl or Command + +/-.

Basic JavaScript: V

Stuff we're skipping

Regular Expressions

  • regularExpression object
  • regEx syntax
  • search and replacing with regEx

Date Objects

  • var today = new Date();
  • var year = today.getFullYear();
  • var month = today.getMonth(); // 0 - 11
  • var date = today.getDate(); // 1 - 31
  • var dayOfWeek = today.getDay(); // 0 - 6

Number

  • isNaN(x);
  • parseInt(x);
  • parseFloat(x);
  • num.toFixed(n)
  • Math.Round(x);
  • Math.floor(x)
  • Math.sqrt(x)
  • Math.abs(x)

Switch statement

var rainbow = prompt('Color');
var teletubby;

switch (rainbow.toLowerCase()) { 
  case "purple":
    teletubby = "Tinky Winky";
    break;
  case "green":
    teletubby = "Dipsy";  
    break;
  case "yellow":
    teletubby = "Laa-Laa";
    break;
  case: "red":
    teletubby = "Po";
    break;
  default:
    teletubby = "You don't watch enough TV";
}

Ternary Operator

(condition)? if true : if false;

var IQ = () ? "glowing" : 

Next

Go