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 chang...
DOM Tree
window
document
head
body
div
p
...
...
Finding DOM node/s
document.getElementById (single node)
document.getElementsByTagName(html
collection)
document.getElemen...
Common Node Properties
nodeName
childNodes
firstChild
lastChild
attributes
innerHTML
...
...
DOM Manipulation
• innerHTML
• outerHTML
• createElement
• appendChild (?existing element)
• removeChild
• setAttribute
• ...
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...
Scope of Variables
• var keyword
• default global scope
• var placement in function
• this keyword
• execution scope in ca...
JQuery
DOM Manipulation
adding/removing classes
setting style
creating nodes
Adding Event Handlers (delegating events)
Aja...
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
Upcoming SlideShare
Loading in …5
×

Java Script Basics

460 views

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
460
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
13
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

×