JavaScript Reference

JavaScript Cheat Sheet: http://overapi.com/javascript

JavaScript Snippet: http://www.javascriptkit.com/cutpastejava.shtml

Namespaced Template: https://css-tricks.com/snippets/javascript/namespaced-javascript-template/

2 Types: 
1. Primitive – numbers, strings, booleans, null, undefined
2. Object

Truthy Value: everything with real value example
Falsy values: 0, -0, NaN, “”, false, null, undefined

Undefined – variable has not yet been initialized to a value
Null – no object

1 == “word” –> false
1 == “” –> false
1 == true –> true
“1” == true –> true
“0” == false –> true
“true” == true –> false
undefined == null –> true
99 <= “100” –> true
0 < true –> true
“banana” < “mango” < “melon” –> true
3 + “4” = 34
“4” + 3 = 43
3 + Number(“4”) = 7
3 * “4” = 12
80 / “10” = 8
“10” – 5 = 5
1 + 2 + ” words” = 3 words
1 + (2 + ” words”) = 12 words
Infinity – “1” = infinity
“result: “+ 10 / 2 = result: 5

Check for NaN: if(isNaN(varName)){…}

Objects: objects, constructors, prototype

Events: example / Event Handler / Onmouseover & Onmouseout – example2 /  Onmousedown & Onmouseup – example2

Form Events: onchange() / onfocus()

element.addEventListener(‘click’, function(event){ … }); lesson

EventListener:  / example / external function / passing parameters / event propagation / removeEventListener() / attachEvent()

Add Many Event Handlers to the Same Element: example / different events

Add an Event Handler to the Window Object: example

Callback or Event Handler or Listener: function name() {…}   window.onload = name; example

Returned Function: varName();

4 Ways to Invoke a Function: as a functionas a methodwith a Function Constructorwith a Function Method call() / with a Function Method apply()

Immediately-invoked Function: functionName(p)();

Function Closures: var varName = functionName(arg1) / varName(arg2) / example2 / example3

Loops with Closure: Technique 1 / Technique 2 / Technique 2 example

Nested Function: example

Creating New HTML Elements: Nodes / insertBefore()

Replacing HTML Elements: replaceChild()

String Prototype: .length / toUpperCase() / toLowerCase() / charAt() – e.g.  / indexOf() / lastIndexOf() / substr() / substring() / split() / trim() / replace() / concat() / slice() / match() / includes() / startsWith() / endsWith() / repeat() / search() / trim()

Number Prototype: isNaN() / toFixed() / toPrecision() / toExponential()

Math Object Property: Math.round() / Math.PI / Math.pow() / Math.sqrt() / Math.abs() / Math.ceil() / Math.floor() / Math.sin() / Math.cos() / Math.min() / Math.max() / Math.round() 

Function Prototype: name / bind() / call() / apply()

Get Window Size: code

Websites: Eloquent Javascript

Algorithm Scripting: code

Books: JavaScript: The Definitive Guide

Advertisements

About bernadetteengleman

Hello, I am Bernadette from New York City. I moved here from Chicago in 2013. I am originally from the Philippines. I started studying web programming in 2015. I love it because I like making fun websites and web apps. The projects that I built so far are posted below. I like to cook and I love to travel. I also like to volunteer and I am a team leader with the non-profit organization, NYCares.
This entry was posted in JavaScript and tagged , , , , , , , , , , , , , , . Bookmark the permalink.