<code> <script>
var Dan = new Object()
Dan.height = 1.85
Dan.age = 41
Dan.eyeColor = "blue"
// method ONE
alert(JSON.stringify(Dan))
// method TWO worked too as below
// alert(JSON.stringify("Dan"))
</script>
</code>
<code> <script>
var Dan = new Object()
Dan.height = 1.85
Dan.age = 41
Dan.eyeColor = "blue"
// method ONE
alert(JSON.stringify(Dan))
// method TWO worked too as below
// alert(JSON.stringify("Dan"))
</script>
</code>
<script>
var Dan = new Object()
Dan.height = 1.85
Dan.age = 41
Dan.eyeColor = "blue"
// method ONE
alert(JSON.stringify(Dan))
// method TWO worked too as below
// alert(JSON.stringify("Dan"))
</script>
Which one is better and why? Appreciated.
I tried the code above on my localhost.