I can't figure out how the toString
method could possibly be of any use when used on a string. A string is already a string and by its very nature it returns the value of the string.
This...
console.log("Hello"); // => "Hello"
console.log(typeof "Hello"); // => string
Seems exactly the same as this...
console.log("Hello".toString()); // => "Hello"
console.log(typeof "Hello".toString()); // => string
If toString
converts something to a string and returns it's value as a string and a string is a string and returns the value of a string I can only conclude that this method is totally meaningless. Am I missing something?
Note: "What is the difference between string literals and String objects in JavaScript?" and "Is there any use value to using the toString method on a string?" are clearly not the same question so I don't think this should be considered a duplicate.