Class Quick Reference

Common Commands in the Terminal

ls — lists what files and folders are in your current directory(folder)

Comments in code

HTML comment looks like this: <! — Write your comments here
CSS: /* Write your comments here */
JavaScript: // Write your comments here

HTML

Read from top to bottom.
Is nested, with open and closing tags. Example of a paragraph in the body of page:

CSS

Read from top to bottom.
Example of 2 HTML elements, with ID and class assigned, and how CSS selects them

JavaScript

JS Variables

Declare with “var”, example: var a;
or declare and assign value at same time, example: var a = 2;
change value of var a, example: a = a+1; this would set a to 3, or a = 3;

JS Primitives

4 for now
Integer — 1, 2, 3, 2000000 , -30
Float — decimal number, 0.2, -5,4
Booleantrue, false
String (technically a composite) — “any kind of sentence or word” , “2”

JS Data Structures

just 2 here lists(arrays) and dictionaries(objects)

Lists

or Arrays have Javascript syntax like this:
var arrayName = [value, value, value]
they are linear
have an index
the index starts at 0, arrayName[0] gets you the first item in the array
they can be sorted: arrayName.sort()
and have a length: arrayName.length

Dictionaries

or Objects have Javascript syntax like this:
{Key:value, key:value}
Objects are not linear
have no index — no first item of object
Cannot be sorted as object — You can sort by key or value into an array.
There is no length — you can get length of all the keys or values.

JS Functions

takes input and “return” output — Note: we will add to this as we start using functions more in more complex code.

JS Logic

3 kinds of conditional statements

D3 Reference

General pattern for creating new elements with data:

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store