Print a javascript representation of an object

Simple example of printing a javascript representation of an object.
<!DOCTYPE html>
<html>
<head>
</head>
<body>

<script>

var person = new Object();
    person.postCode = 03126;
    person.surname = "Kennedy";
    person.age = 12;
    
console.dir(person);
    
</script>

</body>
</html>

Responses

0 Replies