Skip to content

Instantly share code, notes, and snippets.

@KyleMit
Created October 15, 2020 20:36
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 KyleMit/a9c8291f9097fb09d2d16248e26f5e8a to your computer and use it in GitHub Desktop.
Save KyleMit/a9c8291f9097fb09d2d16248e26f5e8a to your computer and use it in GitHub Desktop.
Twitter - Object Initializer Shorthand
let cat = {name: "Frida", age: 10 }
let dog = {name: "Ranger", age: 7 }
// before
console.log("cat", cat)
console.log("dog", dog)
// after
console.log({cat, dog})
// {
// cat: {name: "Frida", age: 10 }
// dog: {name: "Ranger", age: 7 }
// }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment