How to conditionally spread objects in Javascript

How to conditionally spread objects in Javascript

Introduction In Javascript, If we want to spread an object into another one, we usually use the spread syntax operator (…) to do so. Like the following:…