Jari Pennanen on Nostr: Annoying: let { foo } = "bar" let { foo } = 0 let { foo } = false let { foo } = null ...
Annoying:
let { foo } = "bar"
let { foo } = 0
let { foo } = false
let { foo } = null
let { foo } = undefined
With string, number and boolean it doesn't throw error, but with null and undefined it throws error. Yeah, I kind of understand as they are 'objects', but this is annoying.
#javascript
Published at
2025-05-15 10:46:26 UTCEvent JSON
{
"id": "a8290f1f43bc8d8e0372e2efefc010300570082ff5bdd941923ee1895a19ef29",
"pubkey": "379bc9b19be2029f2a8208c9885a934508d9e35a0078d9d2773ebe13d94edb7b",
"created_at": 1747305986,
"kind": 1,
"tags": [
[
"t",
"javascript"
],
[
"proxy",
"https://twit.social/@Ciantic/114511445118876825",
"web"
],
[
"proxy",
"https://twit.social/users/Ciantic/statuses/114511445118876825",
"activitypub"
],
[
"L",
"pink.momostr"
],
[
"l",
"pink.momostr.activitypub:https://twit.social/users/Ciantic/statuses/114511445118876825",
"pink.momostr"
],
[
"-"
]
],
"content": "Annoying:\n\nlet { foo } = \"bar\"\nlet { foo } = 0\nlet { foo } = false\nlet { foo } = null\nlet { foo } = undefined\n\nWith string, number and boolean it doesn't throw error, but with null and undefined it throws error. Yeah, I kind of understand as they are 'objects', but this is annoying.\n\n#javascript",
"sig": "f0f7cba0a0e38ece0ce545e3d45ad11d41327a1bc7eb09771a25a242ebd42f6523c8d269fa18108212b817a91ca89a4675a67b7e2bc4185f88c7383c5c8e603d"
}