Javascript Objects
Object

Object is Just like variable. Like we see variable store data. So that object can also do same thing. But there are some difference between variable and object.

Variable can store data.
Object can store more than one data at once. In object data store by properties. And object also contain method and the role of method is do some process on data that take by properties.

Note:-variable can store only data, but object contain data and method both.

Javascript Objects:-

In Javascript there are three kind of objects:-
Built-in-Object:-
these object built in Javascript language. like Math object,Array Obect String
Object etc.
DOM(Document Object Model):-
Dom object represent various components of the browser and HTML dOcument.
like window object etc.
Custom Object:-
Object that is created by programmer. For example we create Person Object. that maintain person information.

Built-in-Object:-

Math Object
Date Object
String Object
Array Object
Boolean Object

DOM Object:-

Dom is not part of the Javascript language. It is an API(Application Programming interface) build into to the browser. Dom can used by other language like With VBScript etc.

Dom is use:-
To making pages dynamic.
To open new windows
To modifiy text within the page dynamically.
To load new page into the browser. etc.

Given picture show Dom hierarchy.

When we use an object then we use parent object and then child object separated by dot(.)

example to acces image object
window.document.myimage

myimage is name of html img tag.

Custom Object

Custom object create by Programmer.we discuss custom object in later section.


Previous
Next