Out of curiosity:
MDN taught me how to do this:
trim = Function.prototype.call.bind(String.prototype.trim)
join = Function.prototype.call.bind(Array.prototype.join)
Now I can display trim, but not joinfor any reason. jointakes ','as default argument (delimiter), so I should be fine, but instead it uses an array index:
> trim = Function.prototype.call.bind(String.prototype.trim)
call()
> [' a','b '].map(trim)
["a", "b"]
> join = Function.prototype.call.bind(Array.prototype.join)
call()
> [['a','b'],['c','d']].map(join)
["a0b", "c1d"]
Why?
Also, what if I really wanted a different delimiter? Passing it on binddoes not work, because it is added to the existing arguments (at any time, one of the elements of the list on which I map). Then it takes on the role of the strings for concatenation, and the strings for concatenation will act as separators, if there is something to separate:
> joins = Function.prototype.call.bind(Array.prototype.join,';')
call()
> [['a','b'],['c','d']].map(joins)
[";", ";"]
I researched and found:
, this , bind,
, thisArg , MDN map