This file contains hidden or 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
What does the following expression return? | |
4 > 1; | |
true; | |
================================= | |
What does the following expression return? | |
"chatty" === "chatty"; | |
true; | |
================================= |
This file contains hidden or 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
function walkDog( dogname ) { | |
console.log( dogname + " goes for a walk!" ); | |
} | |
walkDog( "Sparky" ); | |
// Sparky goes for a walk! |
This file contains hidden or 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
// What does the following code evaluate to? | |
// var first_name = function (name) { | |
// return name; | |
// } | |
// first_name("bob"); | |
"bob" | |
// What does the following code evaluate to? | |
// function add(x, y) { | |
// return x + y; |
This file contains hidden or 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
> function Dino(name){ this.name=name; } | |
undefined | |
> var myDino = new Dino("Clawpaw"); | |
undefined | |
> Dino.prototype.fight = function(weapon) { | |
... return(this.name + " fought another Dino with a " + weapon + "!"); | |
... } | |
[Function] | |
> console.log(myDino.fight("candlestick")); | |
Clawpaw fought another Dino with a candlestick! |
This file contains hidden or 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
What does the following code print to the console? | |
var person = { | |
name: "Joe Camel", | |
age: 42, | |
status: "dead" | |
} | |
console.log(typeof person); | |
object | |
What does the following code print to the console? |
This file contains hidden or 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
<html> | |
<script type="text/javascript"> | |
function each(array, f) { | |
var new_array = [] | |
for (i = 0; i < array.length; i++) { | |
new_array.push(f(array[i])) | |
} | |
return new_array | |
} | |
function addTwo(element) { |
This file contains hidden or 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
// selectors | |
$("#candyCanes") //says go grab me everything with this id. | |
$(".polarVortex") //class | |
$("footer") //with this element tag | |
// filter selections | |
$("div.foo").has("p"); //with p tag | |
$("h1").not(".bar"); //w/o bar | |
$("ul li").filter(".current"); //w current | |
$("ul li").first(); //first |
This file contains hidden or 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
// 1. selection an element | |
var chart = d3.select(".chart"); | |
var bar = chart.selectAll("div"); | |
// 2. then we have to join data to that element | |
var data = [4,3,5,33,5,67] | |
var barUpdate = bar.data(data); | |
// 3. enter/update/exit | |
var barEnter = barUpdate.enter().append(); | |
// 4. add/update/remove attr, content, styles, etc | |
barEnter.style("width", function(d){ |
This file contains hidden or 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
(ABC|DE) # => capture ABC or DE, once | |
(ABC|DE){2} # => capture ABC or DE, exactly two times. can be ABC or DE twice, or each of them once | |
[ABCDE] # => any of the letters once | |
.* # => any single character, zero or more times. the letter doesn't have to be the same one... | |
#for example, "aa" or "ab" will both be matched | |
[^ABC] # => any character besides ABC | |
a? # => 0 or 1 of a | |
a* # => 0 or more of a | |
a+ # => 1 or more of a |
This file contains hidden or 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
<!-- public/app/partials/show-all.html --> | |
<div class="new-quote-form ng-hide"> | |
<h3>New Quote</h3> | |
<form> | |
<div class="row"> | |
<div class="large-12 columns"> | |
<label for="body">Body | |
<br> | |
<textarea ng-model="newItem.body" rows="4" cols="70" placeholder="To improve is to change..."></textarea> | |
</label> |