Last active
January 13, 2021 09:13
-
-
Save geoffreydhuyvetters/4f5076e36dc691b129916e62fdc0f4ed to your computer and use it in GitHub Desktop.
Wrap any value with an array
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
// not wrapped | |
const foo = 'foo'; | |
// already wrapped | |
const bar = ['bar']; | |
console.log([foo].flat()) | |
// [ 'foo' ] | |
console.log([bar].flat()) | |
// [ 'bar' ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment