Hint
valueOf() is preferred for arithmetic. toString() for string contexts. You can customize both.
const obj = {
valueOf() { return 42; },
toString() { return 'hello'; }
};
console.log(obj + 1);
console.log(`${obj}`);
console.log(obj * 2);43 hello 84
Explanation: For + with number, valueOf() is preferred β 42+1=43. Template literals prefer toString() β "hello". Arithmetic (*) forces numeric: valueOf() β 42*2=84.
Key Insight: valueOf() is preferred for arithmetic. toString() for string contexts. You can customize both.