[Poll in next tweet] In an ideal world, how would you expect array spread and object spread to deal with nullish values?pic.twitter.com/U3uMrqQU0i
You can add location information to your Tweets, such as your city or precise location, from the web and via third-party applications. You always have the option to delete your Tweet location history. Learn more
I'm now concerned about spreading an object whose properties are null. I'd like them to not come across in the spread (or at least not override any properties with existing values)
That’s a different problem. What’s your use case?
Well, null is an object, doesn't throw an error when used in a for...in loop and is an acceptable value for Object.create
What about the other nullish value, i.e. `undefined`?
I like the way it works there. I think of object spread as actually being property spread; null has no properties, so it doesn't add any to the resulting object. But null is not an array and should blow up if you try to treat it as one.
Do you feel the same way about `undefined`?
Throw. Always throw. How could any other answer be satisfied here.
I take it you’re not a fan of object spread’s current behavior, then…
In B), does "nothing" essentially mean an empty array/obj? i.e. `[...array1, ...[]]` & `{ ...obj1, ...{}}`
Nothing refers to the result of the spread. You’re right that it’s the same as spreading an empty array or object — that results in “nothing” too.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.