Mega Code Archive

 
Categories / JavaScript DHTML / Language Basics
 

An object and its constructor

<html> <head> <title>Properties</title> <script type = "text/javascript">     var aObject = {};          function aObject(a,b,c,d) {         this.myValueA = a;         this.myValueB = b;         this.myValueC = c;         this.myValueD = d;     }     aObject["A"] = new aObject("A","C","F",2.0);     aObject["B"] = new aObject("B","D","V",2.3); </script> </head> <body> <script type = "text/javascript" > for (var propt in aObject) {     document.write(propt+"<BR>"); }   </script> </body> </html>