-
-
Save henryspivey/f9993c95197e88cc916d2a0d651c6f4c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| //Why do we get this weird result from the map method? | |
| // myarray.map(func); | |
| //We want to convert 3 strings into numbers | |
| let result = ['1', '7', '11'].map(parseInt); //returns [1, NaN, 3] | |
| // solution | |
| ['1', '7', '11'].map(item => parseInt(item)) | |
| console.log(result); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment