Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

print an object in javascript

<p id="demo"></p>

<script>
const person = {
  name: "John",
  age: 30,
  city: "New York"
};

document.getElementById("demo").innerHTML = JSON.stringify(person);
</script>

result:
Display properties in JSON format:

{"name":"John","age":30,"city":"New York"}
 
PREVIOUS NEXT
Tagged: #print #object #javascript
ADD COMMENT
Topic
Name
1+7 =