Convert JavaScript Objects into Arrays
Posted on: March 02, 2021 by Prince Chukwudire
In this article, you will learn how to convert JavaScript Objects into Arrays.
This we would achieve by using the following JavaScript object method; Object.keys()
.
const user = {
name: "Jane Doe",
occupation: "Student",
age:23
}
console.log(Object.keys(user))
This would throw us an array with these:
["name", "occupation", "age"]
Share on social media
//