//run this in your console
for (var i = 0; i <= 3; i++) {
setTimeout(function(){
console.log(i);
}, 0);
}
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> | |
<link rel="stylesheet" href="css/bootstrap.min.css"> | |
<link rel="stylesheet" href="css/style.css"> | |
<!--Picturefill--> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
font-family: 'HelveticaNeue-UltraLight', 'Helvetica Neue UltraLight', 'Helvetica Neue', Arial, Helvetica, sans-serif; | |
font-weight: 100; | |
letter-spacing: 1px; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Graph = function() { | |
this.nodes = {}; | |
this.edges = {}; | |
}; | |
Graph.prototype.addNode = function(node) { | |
this.nodes[node] = node; | |
}; | |
Graph.prototype.contains = function(node) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*global console: true */ | |
"use strict"; | |
/* | |
A vector type | |
Write a constructor Vector that represents a vector in two-dimensional | |
space. It takes x and y parameters (numbers), which it should save to | |
properties of the same name. | |
Give the Vector prototype two methods, plus and minus, that take another vector as a parameter and return a new vector that has the sum | |
or difference of the two vectors’ (the one in this and the parameter) x | |
and y values. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// under Google Chrome 36 | |
Object.prototype.toString.call([]) | |
// "[object Array]" | |
Object.prototype.toString.call(function(){}) | |
// "[object Function]" | |
Object.prototype.toString.call({}) | |
// "[object Object]" | |
Object.prototype.toString.call(null) | |
// "[object Null]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this function takes in any parameter and can tell if it's "falsy" or not. | |
// falsy means it's either false, 0, null, undefined, NaN, or an empty string/array/object | |
// see the test cases at the bottom for a clearer picture | |
function isFalsy(item) { | |
try { | |
if ( | |
!item // handles most, like false, 0, null, etc | |
|| ( | |
typeof item == "object" && ( |