Object Literal Upgrades

const first = 'snickers';
const last = 'bos';
const age = 2;
const breed = 'King Charles Cav';
const dog = {
    first: first,
    last: last,
    age: age,
    breed: breed,
}

console.log(dog);

key 와 value에 설정된 name이 같다면!

const first = 'snickers';
const last = 'bos';
const age = 2;
const breed = 'King Charles Cav';
const dog = {
    first,
    last,
    age,
    breed,
}

console.log(dog);

하나의 이름만 남겨놓아도 된다.

메소드에서

이렇게 변경할 수 있다.

arrow function을 쓰면 안된다. 'o'

example 1

함수를 하나 추가해 본다.

example 2

Last updated