Skip to content
FLAVIO COPES
flaviocopes.com
2026

The Object valueOf() method

By Flavio Copes

Learn how the JavaScript valueOf() method returns the primitive value of an object, a feature normally used internally by JavaScript and rarely by you.

~~~

Called on an object instance, returns the primitive value of it.

const person = { name: 'Fred' }
person.valueOf() //{ name: 'Fred' }

This is normally only used internally by JavaScript, and rarely actually invoked in user code.

~~~

Related posts about js: