Last active
February 17, 2025 09:06
-
-
Save munierujp/5eab2e66b972e6fa68be55206a15852b 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
const array1: number[] = [1, 2, 3] | |
const array2: boolean[] = [false, true] | |
const array3 = array1.flatMap(a => array2.map(b => [a, b] as const)) | |
/* | |
type: (readonly [number, boolean])[] | |
value: | |
[ | |
[ 1, false ], | |
[ 1, true ], | |
[ 2, false ], | |
[ 2, true ], | |
[ 3, false ], | |
[ 3, true ] | |
] | |
*/ | |
console.log(array3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment