This is similar to restructuring, as @Xufox correctly pointed out.
Functional parameters can actually have a restructuring:
however, I believe this applies to this:
function foo([param1]) { console.log(param1); }
The difference between integers and strings in this behavior:
console.log('123'); //works, outputs 1, '123' = ['1', '2', '3'] of chars console.log(['123']); //works, outputs 123 console.log([123]); //works, outputs 123 console.log(123); //error
In the above example, since the strings are nothing more than an array of characters, it can be clearly seen that it actually works.
source share