Are there any differences between these two pieces of code performance or bug wise?
I don't believe they do, but I found the second snippet in my codebase, so I wanted to be sure that I wasn't going to break something that I didn't try. Everything seems fine when I try it myself on my local server and test the functionality of what is being updated, but wanted to know if I was missing something, or some practice, by adding an empty array first
2 Replies
Depends on what falsy value
response
can be
^ will fail I think
So the || ensures you're spreading a "valid object" on any falsy value for responsesick, thanks.