Display the properties from an object one by one
<head>
<title></title>
</script>
</head>
<body>
<script type = "text/javascript" >
function MyClass(a,b,c,d) {
this.a = a;
this.b = b;
this.c = c;
this.d = d;
}
var MyClass = {};
MyClass["item1"] = new MyClass("A","B","F",2.0);
for (var propt in MyClass) {
document.write( propt );
document.write("<BR>");
}
var names = new Array;
for (propt in MyClass) {
if (names != "") {
names += "," + propt;
} else {
names = propt;
}
}
document.write(names);
</script>
<p>MyClasss</p>
</body>
Related examples in the same category