Skip to main content
7 events
when toggle format what by license comment
Sep 9, 2020 at 19:24 comment added Sulthan @CarsonGraham No, that's not an antipattern. The real problem is that the javascript standard library is full of antipatterns and nasty surprises.
Sep 4, 2020 at 17:50 comment added ruakh @CarsonGraham: Would you avoid array.map(someFunction) even if someFunction is documented to be usable that way?
Sep 4, 2020 at 17:43 comment added Carson Graham Thinking about it, the parseInt function is really similar to the isPalindrome function as it takes in an optional parameter with a default value as the second argument. Despite the "unusual" behavior when using map, parseInt is still part of the standard library. In addition, map passes 3 parameters, not 2, which while you didn't touch on it in your answer, if you're going to pass a function like that you need to know and have the number of arguments memorized.
Sep 4, 2020 at 17:37 comment added Carson Graham using array.map(someFunction) is javascript is generally an antipattern - and should not be used. For example, ["1","2","3"].map(parseInt) returns [1, NaN, NaN].
Sep 4, 2020 at 14:26 comment added Brian In addition to behavioral changes like the one you describe above, exposing internal parameters in the signature also tends to confuse consumers of the function; such parameters are often exposed to the programmer by their IDE.
Sep 2, 2020 at 17:21 history edited Izkata CC BY-SA 4.0
Moving comment up into answer
Sep 2, 2020 at 17:11 history answered Izkata CC BY-SA 4.0