Javascript Flashcards
D3: A good way to visualize binned data is
as shapes.
D3: The three most popular D3 libraries are
dimple.js, Rickshaw, NVD3
D3: The best D3 library for time series or streaming data is
Rickshaw
D3: The DOM gets created during
page load
Javascript: To clear the javascript console, type
clear()
Javascript: In the javascript console, to return the html of the current page that has a certain css id, type
document.getElementById(“cssid”)
Javascript: In the javascript console, to return the html of the current page that has a any css selector, type
document.querySelector(“.css-class”)
D3: To select elements using D3, type
d3.select(“.css-class”)
D3: To select a DOM element and then change its css styled color, type
d3.select(“.css-class”).style(“background-color”, “green”)
D3: To check if the element you are selecting is unique, you can type
d3.selectAll(“.css-class”)
and then make sure the array returned has one item.
D3: To select a DOM element and then change its text, type
d3.select(“.css-class”).text(“New Text”)
D3: To select an element within your current selection, type
current_selection_var.select(“.inner-class”)
D3: To change an html attribute, type
d3.select(“.css-class”).attr(“attribute_name”, “new value”)
javascript: To set a string to uppercase, type
string_var.toUpperCase()
javascript: To create a function, type
function fuctionName() { }
javascript: To create an anonymous function, type
var functionVar = function () { };
note: requires semicolon
javascript: To create a function that returns a string, type
function fuctionName() { return "string" }
jQuery: To hide an html element with the class=”class”, type
jQuery(“.class”).hide();
jQuery: To show an html element with the class=”class” slowly, type
jQuery(“.class”).show(“slow”);
jQuery: The abbreviation for jQuery is
$
jQuery: Most jQuery methods return
the item selected, which allows for method chaining.
javascript: To return all of the html tags of the body of a page, type
document.body.children
javascript: To return all of the html tags on a page with a certain class name, type
document.getElementByClassName(“class”)
jQuery: In the jQuery docs, animations are categorized as
Effects