Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const user = { id: 100, name: 'Howard Moon' }
- const password = 'Password!'
- const userWithPassword = {
- ...user,
- id: 100,
- ...(password && { password })
- }
- userWithPassword //=> { id: 100, name: 'Howard Moon', password: 'Password!' }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement