Why console.log.apply("some string") doesn't work ?
Trying to apply the method .log() to some string or any other variable fails.
For example:
let x = 100;
console.log.apply(x); // doesn't display 100 !
Also, no matter what I use for that variable it doesn't work, either array or object.
let y = [100, 200];
let z = new Date();
console.log.apply(y); // doesn't display [100, 200]
console.log.apply([100, 200]); // doesn't display [100, 200] either
console.log.apply(z); // doesn't display the Date object
console.log.apply({car: "Ford", price: 25000}); // nothing, too
The first argument of .apply this the value of this from the context of the function being executed. The second argument is an array of values being passed as arguments to the function.
So you should pass the array as the second argument:
console.log.apply(null, ["hello"]);
Further documentation can be found on MDN