Redefining existing prototype methods is a very, very dangerous game. It's hard to do correctly, and in this case, it can't be done correctly because you are changing functionality.
Why not just ask for a function bind(fn,context,...args) {}?
There is absolutely no reason for it to be a prototype method anyway, and it's much safer for existing programs that depend on existing functionality.
Actually, this is the biggest gripe I have with JavaScript. "".match()'s return type is inconsistent, and [] would have been perfectly fine instead of null. Most places where you see people using "".match(), you see them ||'ing the result with [].
Yes there are
Needs random tests.
Redefining existing prototype methods is a very, very dangerous game. It's hard to do correctly, and in this case, it can't be done correctly because you are changing functionality.
Why not just ask for a
function bind(fn,context,...args) {}
?There is absolutely no reason for it to be a prototype method anyway, and it's much safer for existing programs that depend on existing functionality.
Please write your kata in English.
Added.
Fixed.
No random tests...
How about mine? ;-)
Approved
Actually, this is the biggest gripe I have with JavaScript.
"".match()
's return type is inconsistent, and[]
would have been perfectly fine instead ofnull
. Most places where you see people using"".match()
, you see them||
'ing the result with[]
.You are right, I just add it.
Thanks for your suggestion.
Good job. Thank you.
Done!
Nice
Loading more items...