Last active
August 30, 2017 08:22
-
-
Save oguzalb/6e2a5b4f3ba0024ca2e1973efd41fc20 to your computer and use it in GitHub Desktop.
map function javascript?!?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
just have seen the comments, thanks : )