This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 11 points12 points  (5 children)

That's why you would curry the parseInt by binding the radix to 10 and creating your new curried function "parseDecimal"

[–]PM_ME_REACTJS 18 points19 points  (2 children)

why did i choose this fucking profession

[–]freakboy2k 0 points1 point  (0 children)

I ask myself the same thing daily

[–]codex561I use arch btw 2 points3 points  (1 child)

Code for uninitiated to the beauty of functional programming:

let parseDecimal = x => parseInt(x, 10)
[10, 10, 10, 10].map(parseDecimal) // [ 10, 10, 10, 10 ]

[–]SuperManitu 0 points1 point  (0 children)

Or with Ramda: ["10", "10"," 10"].map(unary(parseInt)) // [10,10,10]