Skip to content

Instantly share code, notes, and snippets.

@beelarr
Created December 2, 2017 15:16
Show Gist options
  • Save beelarr/aa029e3fabb6c5f490eec317c82ba0b1 to your computer and use it in GitHub Desktop.
Save beelarr/aa029e3fabb6c5f490eec317c82ba0b1 to your computer and use it in GitHub Desktop.
Make great software and the tooling and learning will come.
// Event Delegation
An event listener is fired on all child elements (event bubbling)
An event listener is fired on all parent elements (bubble up)
Target is what was actually clicked
Current Target is what the event listener is attached to
///////////////////////////////////////////////////////////
//IIFE - Immediately invoked function expression - write it and run it
variables inside an iffe are not available outside it.
(function taco() { }) ();
///////////////////////////////////////////////////////////
//Hoisting
when you use 'var' variables are acutally decalred first
when you write functions as statements they are hoisted too.
function statement() {};
function expression = () => {}
const and let are NOT hoisted -- scoped to block
///////////////////////////////////////////////////////////
//Undeclared
you forgot something somewhere
never declared a variable
//Undefined
declaration made by but contains nothing
empty array — let a = [];
index of an array a[3]
variable declaration and then calling a property on it — a.name
const variable have to have a value upon declaration
//null
nothing value
not empty or zero
//Checking for undeclared, undefined, null
Undeclared finds you, except when assigning a value
Undefined check with — taco === undefined (not a string)
Null - taco === null
/////////////////////////////////////////////////////////////////////////////
//== - equality
=== - equality and type
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment