JavaScript Basics Ravi Kumar Hamsa
Primitive Data Types • String • Number (Integer/Float) • Boolean • null • undefined • Regex
Introduction Fully dynamic not secure
Object Data Types • Object • Array • Date • Function
Conditions and Loops • if • while • do while • for • switch • == v/s ===
Arguments Passing primitive data types passed by value object data types passed by reference there is no way you can change it
DOM Tree window document head body div p ... ...
Finding DOM node/s document.getElementById (single node) document.getElementsByTagName(html collection) document.getElementsByClassName(html collection) document.querySelector (single node) document.querySelectorAll (html collection)
Common Node Properties nodeName childNodes firstChild lastChild attributes innerHTML ... ...
DOM Manipulation • innerHTML • outerHTML • createElement • appendChild (?existing element) • removeChild • setAttribute • removeAttribute
DOM Events click mouseenter mouseleave mousedown mouseup keyup keydown window.resize bubbling v/s capturing
Adding Event Listeners/Handlers • setting attribute in html (onclick="jsFunction()") • setting attribute in JS (el.onclick=function(){}) • addEventListener/attachEvent
Scope of Variables • var keyword • default global scope • var placement in function • this keyword • execution scope in callbacks • Function.call and Function.apply
JQuery DOM Manipulation adding/removing classes setting style creating nodes Adding Event Handlers (delegating events) Ajax Calls Deferred
crossdomain data loading iframes flash JSONP CORS
Closures what is closure ajax callbacks setTimeOut callbacks scope chain
Single Threaded Execution JavaScript runs on single thread At any time any one expression is being evaluated examples
prototype chain __proto__ inheritance variable resolution performance considerations

Java Script Basics