Run ❯
Get your
own
website
Result Size:
625 x 565
×
Change Orientation
Save Code
Change Theme, Dark/Light
Go to Spaces
<!DOCTYPE html> <html> <body> <h1>JavaScript Objects</h1> <h2>The Object.values() Method</h2> <p>Object.values() returns an array of values from an object:</p> <p id="demo"></p> <script> // Create an Object const person = { name: "John", age: 30, city: "New York" }; // Create an Array const myArray = Object.values(person); // Display the Array document.getElementById("demo").innerHTML = myArray; </script> </body> </html>