Skip to content

Instantly share code, notes, and snippets.

@oguzalb
Last active August 30, 2017 08:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oguzalb/6e2a5b4f3ba0024ca2e1973efd41fc20 to your computer and use it in GitHub Desktop.
Save oguzalb/6e2a5b4f3ba0024ca2e1973efd41fc20 to your computer and use it in GitHub Desktop.
map function javascript?!?
# Python
>>> map(int, ['10', '20', '30'])
[10, 20, 30]
# Clojure
user=> (map #(Integer/parseInt %) (list "10", "20", "30"))
(10 20 30)
# Scala
scala> Array("10", "20", "30").map(Integer.parseInt)
res4: Array[Int] = Array(10, 20, 30)
# Javascript
> ['10', '20', '30'].map(parseInt)
Array [ 10, NaN, NaN ]
@oguzalb
Copy link
Author

oguzalb commented Aug 30, 2017

just have seen the comments, thanks : )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment