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!

⭐️ install javascript into your brain with the JavaScript Masterclass. -26 days ⭐️