Sunday 15 July 2012

Create a direct instance of an object using javascript


<!DOCTYPE html>
<html>
<body>

<script type="text/javascript">
personObj={firstname:"peter",lastname:"park",age:20,eyecolor:"black"}

document.write(personObj.firstname + " is " + personObj.age + " years old.");
</script>

</body>
</html>

The result is:


Peter is 20 years old.

0 Responses to “Create a direct instance of an object using javascript”

Post a Comment