Object Literals

[Total: 0    Average: 0/5]

This just shows how to create a data object literal and how to access it.

Body Code:

<script type=text/javascript>
var man = {
  name    : "mike",
  age     : "old",
  married : true,
  email   : "mike@js-examples.com"}
document.writeln("man.name="+man.name+"<BR><BR>")
var x=0
for (var i in man)
document.writeln("#"+ (++x) +": "+i+"="+man[i]+"<BR>");
</script>

Times Viewed: 0

Leave a Reply

Your email address will not be published. Required fields are marked *