Explanation: valueOf():
Returns the primitive value of a Number object.
β
Correct answer
toString():
Converts the number to a string.
toLocaleString():
Returns a string with a language-sensitive representation of the number.
toPrecision():
Formats the number to a specified precision and returns it as a string.
Example:
let num = new Number(42);
console.log(num.valueOf()); // 42
console.log(num.toString()); // "42"
console.log(num.toLocaleString()); // e.g., "42" (depends on locale)
console.log(num.toPrecision(2)); // "42"
? Only valueOf() returns the raw numeric value.
β
Answer: (B) valueOf()