Class Objects

Three way to create JavaScript object:

Using Object leteral:

Syntax:

object={property1:value1,.....propertyN:valueN}

Ex.

<script>

      emp={id:10,name:"naveen",salary:40000}

</script>

 

Using instance of Object:

Syntax:

var objectname=new Object();

Ex.

<script>

     var person=new Object();

     person.id=10;

     person.name="naveen kumar";

    document.write(person.id+" "+person.name");

</script>

Powered  by Codersarts