JavaScript – Object Basics By Satyen

833 views

Published on

JavaScript – Object Basics

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

  • Be the first to like this

No Downloads
Views
Total views
833
On SlideShare
0
From Embeds
0
Number of Embeds
14
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

JavaScript – Object Basics By Satyen

  1. 1. By: Satyen Pandya<br />1<br />JavaScript – Object Basics<br />satu21@gmail.com<br />
  2. 2. Contents<br />2<br /><ul><li> Object-Oriented Terminology
  3. 3. Early v/s. Late Binding
  4. 4. Types of Objects
  5. 5. Defining Classes & Objects
  6. 6. Modifying Objects</li></ul>satu21@gmail.com<br />
  7. 7. Object-Oriented Terminology<br />3<br /><ul><li> ECMA-262 defines Object as an unordered collection of</li></ul> properties each of which contains a primitive value,<br /> object or function<br /><ul><li> Four basic features of OOP:</li></ul>Encapsulation<br />Aggregation<br />Inheritance<br />Polymorphism<br />satu21@gmail.com<br />
  8. 8. Early versus Late Binding<br />4<br /><ul><li> Binding – the method whereby an object’s interface is</li></ul> bound to an object instance<br /><ul><li>Early Binding – Properties and methods are defined for</li></ul> an object before it is instantiated<br /><ul><li> Late Binding – The compiler/interpreter doesn’t know</li></ul> what type of object is being held until runtime<br /><ul><li> ECMAScript doesn’t support early binding
  9. 9. ECMAScript uses late binding for all variables</li></ul>satu21@gmail.com<br />
  10. 10. Types of Objects<br />5<br /><ul><li> Three types of objects can be used/created :</li></ul>Native Objects<br />Built-in Objects<br />Host Objects<br />satu21@gmail.com<br />
  11. 11. Types of Objects (Contd…)<br />6<br /><ul><li>Native Objects : any object supplied by an ECMAScript</li></ul> implementation independent of the host environment<br /><ul><li> All the native objects includes a list of built-in functions</li></ul> and properties<br /><ul><li> They includes :</li></ul>satu21@gmail.com<br />
  12. 12. Types of Objects (Contd…)<br />7<br /><ul><li>Built-in Objects : Object which is present at the start of</li></ul> execution of ECMAScript program<br /><ul><li> It is already instantiated
  13. 13. ECMA-262 defines only two objects :</li></ul>Global<br />Math<br /><ul><li>Global – includes functions like, isNan(), isFinite(), parseInt(),</li></ul>parseFloat(), etc.<br /> - properties like, undefined, NaN, Infinity, Constructors for<br /> all Native Objects<br /><ul><li> Math – includes functions like, max(), min(), ceil(), round(),</li></ul> floor(), etc.<br /> - properties like, E, LN10, LOG2E, LOG10E, PI, SQRT1_2,<br /> SQRT2<br />satu21@gmail.com<br />
  14. 14. Types of Objects (Contd…)<br />8<br /><ul><li>Host Objects : any object that is not a native
  15. 15. All BOM and DOM objects are host objects</li></ul>satu21@gmail.com<br />
  16. 16. Defining Classes & Objects<br />9<br /><ul><li> Classes can be defined same as function
  17. 17. We can define class in different ways :</li></ul>Factory paradigm<br />Constructor paradigm<br />Prototype paradigm<br />Hybrid constructor/prototype paradigm<br />Dynamic prototype<br />Hybrid factory paradigm<br />satu21@gmail.com<br />
  18. 18. Modifying Objects<br />10<br /><ul><li> Objects can be modified by using prototype property
  19. 19. We can modify object in different ways :</li></ul>Creating a new method<br />Redefining an existing method<br />Very late binding<br />satu21@gmail.com<br />
  20. 20. Thank you…<br />By: Satyen Pandya<br />11<br />satu21@gmail.com<br />

×