Page 157 - DCAP202_Fundamentals of Web Programming
P. 157

Fundamentals of Web Programming                               Deepak Mehta, Lovely Professional University




                    Notes                       Unit 13: Building Object of JavaScript


                                     CONTENTS
                                     Objectives

                                     Introduction
                                     13.1 Using JavaScript as a Scientific Calculator
                                          13.1.1  JavaScript Objects for a Date
                                          13.1.2  Creating Arrays and Objects

                                     13.2 String Object
                                          13.2.1  Chaining Methods
                                     13.3 The Math Object
                                     13.4 Date Object

                                          13.4.1  Using Date Methods
                                     13.5 User Defined Objects
                                          13.5.1  The New Operator
                                          13.5.2  The Object () Constructor

                                     13.6 Summary
                                     13.7 Keywords
                                     13.8 Review Questions
                                     13.9 Further Readings


                                   Objectives

                                   After studying this unit, you will be able to:

                                      Using JavaScript as a scientific calculator
                                      Explain Math Object
                                      Explain String Object
                                      Explain Date Object
                                      User Defined Object

                                   Introduction


                                   Objects in JavaScript, just as many other programming languages, can be compared to objects in
                                   real life. The concept of objects in JavaScript can be understood with real life, tangible objects.
                                   In JavaScript, an object is a standalone entity, with properties and type.


                                          Example: Compare it with a cup. A cup is an object, with properties. A cup has a colour,
                                   a design, weight, a material it is made of, etc. The same way, JavaScript objects can have properties,
                                   which define their characteristics.



          150                               LOVELY PROFESSIONAL UNIVERSITY
   152   153   154   155   156   157   158   159   160   161   162