J query (intermediate)
-
Upload
madhukar-anand -
Category
Internet
-
view
642 -
download
0
Transcript of J query (intermediate)
1
JQUERY – INTERMEDIATE
2
ROAD MAP
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)
3ALLONGE (FRENCH) = ELONGATE
4
JS – PRESENT, PAST & FUTUREJava Script
jQuery, Mootools, YUI etc(Client Side Framework)
MVC (Model, View & Controller)
Client Side Server Side
Angular JS(By Google)Backbone JS
etc
Node JSNarwhal
etc
5
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.
6
7
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
8
VALUES & IDENTITY
var n = "1";
console.log(n==1);
console.log(n===1);
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.
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
11
OBJECT
12
DELEGATION
13
DELEGATION OF MESSAGES
14
VARIABLE SCOPE
15
CLOSURES
16
EXAMPLE FOR CLOSURES
17
HOW CLOSURES WORKS?
18