Skip to content Skip to sidebar Skip to footer

The Object.values() method is a built-in method in JavaScript that returns an array of the values of an object’s own properties (excluding any inherited properties). The values are returned in the same order as they appear in the object.

Syntax:

Object.values(obj);

Example:

const person = { 
  name: 'John', 
  age: 30, 
  city: 'New York'
}; 
console.log(Object.values(person)); // Output: ['John', 30, 'New York']

Copyright © 2023. All rights reserved.

Copyright © 2023. All rights reserved.