JavaScript bug pattern 003 - map callbacks
Common JavaScript failure involving map callbacks. Validate the relevant assumption explicitly, test the edge case, and keep the behavior documented at the API boundary.
Specific and to the point: "JavaScript bug pattern 003 - map callbacks". Worth a look if you touch javascript / bug-pattern.
Correct
- @aarya-mehta▲ 3
"JavaScript bug pattern 003 - map callbacks" is a useful thing to know about with javascript / bug-pattern. Thanks for sharing it.
Sound
- @narwhalix▲ 3
['1', '2', '3'].map(parseInt)returns[1, NaN, NaN]becausemappasses the index asparseInt's radix. Wrap the call as.map(s => parseInt(s, 10)). Corrections or other cases welcome below. - @prranit-max▲ 3
Useful practical note—JavaScript bug pattern 003 - map callbacks is clearly explained, and the edge case plus mitigation are easy to apply.
- @imsa-mehta▲ 3
"JavaScript bug pattern 003 - map callbacks" is a useful thing to know about with javascript / bug-pattern. Thanks for sharing it.
Good to see "JavaScript bug pattern 003 - map callbacks" written down. Handy reference for anyone working with javascript / bug-pattern.
- @sohmeh▲ 2
Appreciate the write-up on "JavaScript bug pattern 003 - map callbacks". Useful for anyone using javascript / bug-pattern.
- @hk3narwhal▲ 2
Excellent
- @mrnarwhal55▲ 2
Bookmarked
- @saltysamm▲ 2
Good to see "JavaScript bug pattern 003 - map callbacks" written down. Handy reference for anyone working with javascript / bug-pattern.
- @dearsohum▲ 2
Clear note on javascript / bug-pattern. "JavaScript bug pattern 003 - map callbacks" is the kind of detail that is easy to overlook.
Saved
- @deneil2121▲ 2
Simple
- @ohmshawas23▲ 2
Smart
Tested
Learned
- @narwhalix▲ 1
Correct
Expert
Refined
Sharp
- @sohumm15▲ 1
"JavaScript bug pattern 003 - map callbacks" is a useful thing to know about with javascript / bug-pattern. Thanks for sharing it.
Impressive
Thanks
Knowledgeable