1131 0 0 0
Last Updated : 2025-04-28 23:24:58
In order to convert an object into an array, this is easy using the Object.values() method. On the other hand if you want to convert an object into a string, any Object can be converted to a string using the JSON.stringify() method.
const PHP = new Object();
PHP.name = 'Advanced PHP Techniques';
PHP.length = 40 ;
PHP.price = 3000 ;
PHP.discount = function() {
console.log(this, this.price);
}
const ObjectArray = Object.values(PHP);
console.log(ObjectArray); // This is now an Array?
Read Also