The Object valueOf() method

Find out all about the JavaScript valueOf() method of an object

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.

Download my free JavaScript Beginner's Handbook and check out my JavaScript Masterclass!

⭐️ Join the waiting list for the JavaScript Masterclass ⭐️