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

Was this helpful?