Certified PRO developer move: if you want to encode a set in JSON, use a map with arbitrary values: { "a": "please", "b": "don't", "d": "actually", "c": "do", "e": "this" }
-
-
I think I just realised that the values you wanted to store were a, b, c, d & e, not the words!
-
Yeah, I realized way too late that it wasn't really obvious
End of conversation
New conversation -
-
-
Restricted to strings, and even at that, only the ones that are valid JS identifiers?
-
you sure about the valid identifiers? You can put pretty much any string into a JS object's key, no? const a = { "foo-bar": 10 } And yes, it's restricted to strings... but for numbers, you can use a list! [0,0,null,0,<100 nulls>,0] means a set of {0,1,3,104} ;)
- Show replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.