CARVIEW |
Select Language
HTTP/2 307
date: Sat, 11 Oct 2025 13:59:06 GMT
content-type: text/html
content-length: 58
location: https://how.dev/answers/what-is-objectvalues-in-javascript
cf-ray: 98cee044fccbc1a1-BLR
cache-control: public, max-age=300, stale-while-revalidate=604800
referrer-policy: strict-origin-when-cross-origin
x-app-version: v251008-h-251010-1202
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
x-xss-protection: 1; mode=block
x-app-type: Learn
x-robots-tag: all
x-nextjs-cache: MISS
x-cloud-trace-context: a5af81318cb738fcc0ae7d477137ed00
via: 1.1 google
alt-svc: h3=":443"; ma=86400
cf-cache-status: MISS
set-cookie: __cf_bm=tYuh9.LWCnp.yU1R.F7nxbyyWHKXSNsM7ONnIOIsk6U-1760191146-1.0.1.1-.HxWZqbFZhsjdmRgvERG.FO9.R9Au21vxe6JfT9NR3s3M1P6u_aR.LF9ciPq1qR7zTO3W5tmRkzPmQk8UX5ulSOjISK8LAXlEwL7NbKX7zY; path=/; expires=Sat, 11-Oct-25 14:29:06 GMT; domain=.educative.io; HttpOnly; Secure; SameSite=None
vary: Accept-Encoding
strict-transport-security: max-age=31536000; includeSubDomains; preload
server: cloudflare
HTTP/2 200
cache-control: public, max-age=300, stale-while-revalidate=604800
referrer-policy: strict-origin-when-cross-origin
x-app-version: v251008-h-251010-1202
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
x-xss-protection: 1; mode=block
x-app-type: Learn
x-middleware-rewrite: /answers/howdev/what-is-objectvalues-in-javascript
x-nextjs-cache: MISS
etag: W/"zg3nyqvz0v6mk1"
content-type: text/html; charset=utf-8
x-cloud-trace-context: 470a19a561f82ff81a6b431368a5c2d2
date: Sat, 11 Oct 2025 13:59:06 GMT
server: Google Frontend
via: 1.1 google
vary: Accept-Encoding
content-encoding: gzip
x-cache-status: miss
alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
What is Object.values in JavaScript?
What is Object.values in JavaScript?
By using Object.values
, we can get the values of the object. This method will return an array that contains the object’s own enumerable property values. The order of the returned values is the same as the order that it occurs in the for…in
loop.
Syntax
Object.values(obj)
Example
let employee = {companyName : "Educative"};let manager = Object.create(employee);manager.name = "Ram";manager.designation = "Manager";manager.getName = function(){return this.name;}manager[Symbol("symbol")] = "symbol";Object.defineProperty(manager, "non-enumerable", {enumerable: false})console.log("The manager object is ", manager);console.log("\nValues of the manager object is ", Object.values(manager))// the values of non-enumerable properties,symbols and inherited properties are not included in the keys
In the above code, we have:
- Created the
manager
object from theemployee
object. - Added
symbol
as a property key to themanager
object. - Added a
non-enumerable
property to themanager
object.
When we call the Object.values
method by passing the manager
object as an argument, we will get an array of its own object property values. The returned array doesn’t include the values of:
- Symbols
Inherited properties In our case, employee
object properties are inherited properties, so those property values are not included.Non-enumerable properties The properties that don’t occur in the for…in loop; in our case, the non-enumerable
property ofmanager
object.
Relevant Answers
Explore Courses
Free Resources