String.prototype.valueOfbeginnerconst str = 'Hello'
str.valueOf() // β 'Hello'
new String('hi').valueOf() // β 'hi'Use valueOf() to return the primitive string value, useful when working with String wrapper objects.
JavaScript calls valueOf() implicitly when an object is used in an arithmetic expression.
Challenge: Implement strLength(str) that returns the number of characters using valueOf().
strLength('hello') // β 5