Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

JavaScript – Object Basics By Satyen


Published on

JavaScript – Object Basics

Published in: Technology
  • Be the first to comment

  • Be the first to like this

JavaScript – Object Basics By Satyen

  1. 1. By: Satyen Pandya<br />1<br />JavaScript – Object Basics<br /><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><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 /><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><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 /><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><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 /><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><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 /><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 /><br />
  20. 20. Thank you…<br />By: Satyen Pandya<br />11<br /><br />