Java Script Basics

345
-1

Published on

Deck JavaScript Introduction Training

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
345
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
12
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Java Script Basics

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

×