It probably has nothing to do with the production point of view, but I would like to know why this behaves the way it happens. The string literal is interpreted as an object.
function fancyCallback(callback) { callback(this); console.log(typeof this);
I need to call
this.toString()
inside the function if I want the expected output. I know that strings are objects in javascript (which is great), but in simple console.log ('abc') they are naturally interpreted as strings. Why is this? This is useful? Please ignore the fact that fancyCallback is defined in a global scope!
javascript string
A. sallai
source share