in object js how check in if code example
Example 1: javascript check if object
typeof yourVariable === 'object' // true if it's an object or if it's NULL.
// if you want to exclude NULL
typeof yourVariable === 'object' && yourVariable !== null
Example 2: checking a condition in object javascript
{ id: 'some-id', ...(true && { optionalField: 'something'})}