I was trying your _log function.
Do I need to include a JSON library for this?
When I put your code in a page with nothing else, I see there is a JSON object there with a stringify function.
I just get an empty object logged though.
Can you explain please?
Thanks
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<script>
function Animal()
{
this.breathe = function ()
{
alert("I am breathing");
};
this.eat = function ()
{
alert("I am eating");
};
this.sleep = function ()
{
alert("I am sleeping");
};
}
var _log = function (label, obj)
{
if (typeof console.log === 'function')
{
console.log(label + ": " + JSON.stringify(obj, undefined, '\t'));
}
};
var cat = new Animal();
_log("Animal", cat);
</script>
</body>
</html>