Relative Content

Tag Archive for javascriptjson

stringify() object value using with JSON

<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. javascript json