Last active
February 3, 2022 10:36
-
-
Save munkacsitomi/d2c2908db2f810504b6bfe6977d3265b to your computer and use it in GitHub Desktop.
Map types
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
const stringNumbers = ['123', '4.45', '5,25', 'abc', '10000']; | |
const numbers = stringNumbers.map(Number); | |
console.log(numbers); // [123, 4.45, NaN, NaN, 10000] | |
const stringBoolean = ['false', false, '0', 0, null, undefined]; | |
const booleans = stringBoolean.map(Boolean); | |
console.log(booleans); // [true, false, true, false, false, false] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment