let x = 123;
x.valueOf();
(123).valueOf();
(100 + 23).valueOf();
/* ValueOf is a prototype that give the Primitive value of a variable
where typeof will give only it types e.g
*/
const numObj = new Number(42); // let numObj = 42; will work too
console.log(typeof numObj); // output: "object"
const num = numObj.valueOf();
console.log(num);// output: 42
// it works with any type that have a primitive type
let str = new String("Hello"); // let str = "Hello"; will work too
console.log(str.valueOf()) // output: "Hello"