Programming Examples

Are you a Programmer or Application Developer or a DBA? Take a cup of coffee, sit back and spend few minutes here :)

Tag Archive for ‘this’

JavaScript Creating Custom Object

Fig 3. JavaScript - Create Object Single Unit Syntax

In our past JavaScript examples, we used the built-in objects. Now, we will create our own Custom Object. Let us say we want to store related information about the Car; like color, number of tires and seating capacity. We can create three separate variables to denote these information. But it becomes hard when we want to represent more than one car and maintaining these variables. Also, if you want to provide functionalities like start a car, stop a car and speed up, you should use correct variables that belong to a specific car. We can solve all these problems when we group variables and functions in a single unit. Alright! Welcome to Class and Objects.

Continue Reading →