JQUERY – INTERMEDIATE
1
ROAD MAP
2
1. JS - Present, Past & Future
2. Javascript Vs jQuery
3. JS Engine
4. Value & Identity
5. Class Vs Prototype
6. Object
7. Delegation
8. Closures
9. DOM & Left things (Next Time)
ALLONGE (FRENCH) = ELONGATE
3
4
JS – PRESENT, PAST & FUTURE
jQuery, Mootools, YUI etc(Client Side Framework)
Client Side Server Side
Angular JS(By Google)
Backbone JS
etc
Node JS
Narwhal
etc
WHAT WE CAN NOT DO IN JS
- File I/O
- Using Ajax, JavaScript can send a request to the server. This
request can read a file in XML or plain text format but it cannot write
to a file unless the file called on the server actually runs as a script
to do the file write for you.
- Networking
- DB APIs
- unless you use Ajax and have a server side script perform the
database accesses for you.
- So, Node or other JSs has come.
5
6
WHAT IS JAVASCRIPT ENGINE ?
A JavaScript engine is process virtual machine which interprets
and executes JavaScript (also known as ECMAScript).
Source – WiKi
Web Browsers Engine Used
FF SpiderMonkey
Chrome V8
Safari JavascriptCore
IE Chakra
7
VALUES & IDENTITY
var n = "1";
console.log(n==1);
console.log(n===1);
8
JAVASCRIPT BY OOPS, BUT NOT
"CLASS"-ICAL LANGUAGES.
- Object-Oriented
- Class – Object Relation
- But there are no classes in JavaScript. Functions can be
used to somewhat simulate classes.
- And when it comes to inheritance, objects inherit from
objects, not classes from classes as in the "class"-ical
languages.
- So, Java Script is NOT a "class"-ical languages.
9
CLASS VS PROTOTYPE
- Yes, there are no classes in JavaScript.
- But Functions can be used to somewhat simulate classes.
- A drawback of CLASS is that the method getInfo() is
recreated every time you create a new object.
- A more inexpensive way is to add getInfo() to the
prototype of the constructor function.
- Class - Based :
- Code reuse through Inheritance
- Class - Object communication
- Prototype - Based :
- Code reuse through delegation
- Class - Object communication
10
OBJECT
11
DELEGATION
12
DELEGATION OF MESSAGES
13
VARIABLE SCOPE
14
CLOSURES
15
EXAMPLE FOR CLOSURES
16
HOW CLOSURES WORKS?
17
18

jQuery (intermediate)

  • 1.
  • 2.
    ROAD MAP 2 1. JS- Present, Past & Future 2. Javascript Vs jQuery 3. JS Engine 4. Value & Identity 5. Class Vs Prototype 6. Object 7. Delegation 8. Closures 9. DOM & Left things (Next Time)
  • 3.
  • 4.
    4 JS – PRESENT,PAST & FUTURE jQuery, Mootools, YUI etc(Client Side Framework) Client Side Server Side Angular JS(By Google) Backbone JS etc Node JS Narwhal etc
  • 5.
    WHAT WE CANNOT DO IN JS - File I/O - Using Ajax, JavaScript can send a request to the server. This request can read a file in XML or plain text format but it cannot write to a file unless the file called on the server actually runs as a script to do the file write for you. - Networking - DB APIs - unless you use Ajax and have a server side script perform the database accesses for you. - So, Node or other JSs has come. 5
  • 6.
  • 7.
    WHAT IS JAVASCRIPTENGINE ? A JavaScript engine is process virtual machine which interprets and executes JavaScript (also known as ECMAScript). Source – WiKi Web Browsers Engine Used FF SpiderMonkey Chrome V8 Safari JavascriptCore IE Chakra 7
  • 8.
    VALUES & IDENTITY varn = "1"; console.log(n==1); console.log(n===1); 8
  • 9.
    JAVASCRIPT BY OOPS,BUT NOT "CLASS"-ICAL LANGUAGES. - Object-Oriented - Class – Object Relation - But there are no classes in JavaScript. Functions can be used to somewhat simulate classes. - And when it comes to inheritance, objects inherit from objects, not classes from classes as in the "class"-ical languages. - So, Java Script is NOT a "class"-ical languages. 9
  • 10.
    CLASS VS PROTOTYPE -Yes, there are no classes in JavaScript. - But Functions can be used to somewhat simulate classes. - A drawback of CLASS is that the method getInfo() is recreated every time you create a new object. - A more inexpensive way is to add getInfo() to the prototype of the constructor function. - Class - Based : - Code reuse through Inheritance - Class - Object communication - Prototype - Based : - Code reuse through delegation - Class - Object communication 10
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.