Well,
Function.prototype.callreferences the “call” function, which is used to invoke functions with chosenthisvalues;- The subsequent
.bindrefers to the “bind” function on the Function prototype (remember: “call” is a function too), which returns a new function that will always havethisset to the passed-in argument. - The argument passed to “bind” is the “toString” function on the Object prototype, so the result of that whole expression is a new function that will run the “call” function with
thisset to the “toString” function.
The result, therefore, is like this code: Object.prototype.toString.call( param ). Then, the “console.log” call passes that function an array, and there you have it.
edit Note that Object.prototype.toString.call( param ) is like param.toString() really, when “param” is an object. When it’s not, then the semantics of the “call” function are to turn it into one in the normal ways JavaScript does that (numbers -> Number, strings -> String, etc).
edit, 24 May2016 — That last sentence above is not accurate with ES2015. New JavaScript runtimes do not “autobox” primitive types when those are involved with a function call as a this value.