Eric A. Meyer on Nostr: I did this recently in JS and unusually, I’m sorry about it. Even given that I’m ...
I did this recently in JS and unusually, I’m sorry about it. Even given that I’m operating on an array and there can be occasional `undefined` (that is, missing array index) items, and I want to output a string result, surely there’s a better way to do this, right? Tell me.
```
let mask = [prevSet[a-1],prevSet[a],prevSet[a+1]].map((item)=>{ if(typeof item === 'undefined') return 0); else return item;}).join('');
```
Published at
2024-02-07 14:05:00Event JSON
{
"id": "db641294d042413f5af74e11c0d3c4c37f6a3bb325a669f640ea4c65b2124aa4",
"pubkey": "6a32e47d258bb692f15a085dbdcb60ed381bb2921af6b4db1107a7ea545109cc",
"created_at": 1707314700,
"kind": 1,
"tags": [
[
"proxy",
"https://mastodon.social/users/Meyerweb/statuses/111890576187919604",
"activitypub"
]
],
"content": "I did this recently in JS and unusually, I’m sorry about it. Even given that I’m operating on an array and there can be occasional `undefined` (that is, missing array index) items, and I want to output a string result, surely there’s a better way to do this, right? Tell me.\n```\nlet mask = [prevSet[a-1],prevSet[a],prevSet[a+1]].map((item)=\u003e{ if(typeof item === 'undefined') return 0); else return item;}).join('');\n```",
"sig": "1f030fd0b437f19fe725954f08b59586ca9cf42f3c20c6331aa99bd87e54c9f5a1044fe9c1171b5c30cc304dbcc594ee7c8526ba0bd1764d4abb19bcff76d707"
}