Version Control software that you need to install on your machine, and initiate in every project. Keeps a history of moments in time (commits) for your project (repository)
A web platform that you can store your code files (repositories) including your git history. Has many features suited for team collaboration
Recommended Command Line Program for Windows: Powershell
Recommended Command Line Program for Mac: iTerm
Use typeOf() to check !
var adorable = 'Maru in a bucket!'
call the variable by it's name
and use = to re/assign
Function Declaration
function speak (words) {
console.log(words);
}
Function Expressions
var speak = function (words) {
console.log(words);
}
Invoke a function
myFunction();
pass in argument
myFunction(myArgument);
arguments take the place of perameters
function myFunction(perameter){
//do something
}
function sum (x, y) {
return x + y;
}
function double (z) {
return z * 2;
}
var num = sum(3, 4)
=> 7
var numDbl = double(num);
=> 14
// This can also be written:
var num = double(sum(3,4));
=> 14
Access something from ANYWHERE in the program
A variable with local scope cannot be referenced outside of that function.
// Global Scope
var a = "Hello";
function sayHello(name) {
// Local Scope
var b = 'kitten';
return a + " " + name;
}
sayHello("JavaScript");
=> "Hello JavaScript";
kitten;
=> undefuned
myObject = {
name: 'Jessica',
age: 31,
favAnimal: 'cat',
isAwesome: true,
}
var myHouse = {};
var myCar = new Object();
var myMotorcycle = {
wheels: 2,
color: "blue",
maxSpeed: 300,
owners: ["Sofia", "Rose"]
}
// Setting
myCar.wheels = 4;
myCar["doors"] = 2;
// Accessing
myCar.wheels;
=> 4
myCar['doors'];
=> 2
for (var i in myHouse) {
if (myHouse.hasOwnProperty(i)) {
// The "hasOwnProperty method returns true
// if an object property has a certain key"
console.log(i + " = " + myHouse[i] + "\n");
}
}
var Kitten = function(kittenName){
this.name = kittenName;
}
var Sam = new Kitten('sam');
Sam.name;
=> 'sam'
We use JSON objects to transfer data between applications and Javascript.
To keep everything consistent, all JSON code must follow a number of strict conventions :
DOM
The Document Object Model (DOM) is a programming interface for HTML and XML documents.
It represents the page so that programs can change the document structure, style and content.
The DOM represents the document as nodes and objects. That way, programming languages can connect to the page.
Document.getElementById(String id)
Document.querySelector(String selector)
Document.querySelectorAll(String selector)
Use object dot notation to access and update elements and their styles, text, and much more using the DOM.