Skip to content

Instantly share code, notes, and snippets.

@chickenfoot88
Created July 1, 2019 09:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chickenfoot88/8bf1a2f45cd8a28bceb683734c80dfa8 to your computer and use it in GitHub Desktop.
Save chickenfoot88/8bf1a2f45cd8a28bceb683734c80dfa8 to your computer and use it in GitHub Desktop.
sets a property on an object
let myProperty = {
id: 1,
name: 'one'
}
const myObject = { ...myProperty && { propName: myProperty } };
console.log('myObject', myObject)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment