Maybe one day I'll add some:

default

 

//////////////////////
// Debugging on a page

/*
var nonos = [];
for (var ii in window){
  nonos.push(ii)
};
alert(nonos.join("\n"));
*/
// This can be used to get all globals on a page
//end-debugging-on-a-page
/////////////////////////

/*
  Block comment
  aka Multi-line comment
  Do not use block comments to comment out code.
  Regular expressions are one reason for this.
*/

// A line ending comment
// Comment out code with these.

// All varaibles are global

/*
  False values are:
  false, null, undefined, '', 0, NaN
*/

<script>
var im_so_empty = {};
var im_so_full = {
      liquid: "water",
      solid: "sand",
      gas: "No not me!"
};

var grub = {
      "fish": "worm",
      "bird": "seed",
      "korean": "dog"
};

var favoriteGrub = grub["armadillo"] || "Armadillos don't exist";

document.writeln(im_so_full.gas);
document.writeln(grub.korean, grub["fish"]);
document.writeln(favoriteGrub);
</script>
// An empty object
// Simple object creation and retrieval
// Default value using ||




/////////////////////////
// Regular Expressions //
// ------------------- //

// ?+*|.^$\/[](){} must be escaped in a regex
// -^[]/\ must be escaped in a [regex class]

// Three flags are: g, i, m
// g = global
// i = case-insensitive
// m = multiline

<script>
var which_are_you = "match-maker".match(/mat|match/)
if (which_are_you == 'mat') {
  document.writeln("Tough luck... Enjoy being a door" + which_are_you + "!");
} else {
  document.writeln("Wow such a spark! You lit her like a match");
}
</script>
// The first match will be taken, rest ignored


<script>
if (/xxx/.test("xxx") && /x{3}/.test("xxx")) {
  document.writeln('Close your eyes, sex is bad');
} else {
  document.writeln('No, only evil people have babies...'); 
}
</script>
// /x{5}/ is another way to write /xxxxx/
// {4,5} = 4 or 5 matches
// ? = 0 or 1 = {0,1}
// * = 0 or more = {0,}
// + = 1 or more = {1,}


//end-regular-expressions
/////////////////////////

default