Java Script 배열과 객체의 네스트

piper ·2023년 1월 1일
0

Java Script 

목록 보기
1/21

배열과 객체는 아래와 같이 혼합해서 사용할 수 있다.

하나의 배열 안에 객체가 들어감

const shoppingCart = [
{
product: 'Gommie Bear',
price: 6.88,
quantity: 1
},
{
product: 'Jelly Beans',
price: 26.88,
quantity: 3
},
{
product: 'Fire Stick',
price: 15.88,
quantity: 2
}
]

객체 안에 배열이 있고 객체 안에 객체도 사용 가능
const student = {
firstname: 'David',
lastname: 'Jones',
Strengths: ['Music','Art'],
exams : {
midterm: 92,
final: 88
}
}

profile
메모장

0개의 댓글