shorthand properties

Estimated reading time: 1 minute

default properties

let users = {
  name: 'kamal',
  age: 21
}
let phone = {
  home: 121,
  office: 999
}

let employee = {
  users: users,
  phone: phone
}
console.log(employee)
/*{
  users: {
    name: 'kamal',
    age: 21
  },
  phone: {
    home: 121,
    office: 999
  }
}
*/

shorthand properties

let users = {
  name: 'kamal',
  age: 21
}
let phone = {
  home: 121,
  office: 999
}

let employee = {
  users,
  phone
}
console.log(employee)
/*{
  users: {
    name: 'kamal',
    age: 21
  },
  phone: {
    home: 121,
    office: 999
  }
}
*/
es, es6, js