티스토리 뷰

Object(객체)
개인정보를 저장하고 싶다면
const nicoInfo = ["Nicolas","55", true, "Seoul"];
console.log(nicoInfo);
Nicolas, 55, true, Seoul가 나오는 이방법은 비효율적이다.
Object는 Array 같이 작동하지 않는다.
const nicoInfo = {
name:"Nico",
age: 33,
gender:"Male",
ishuman:true
favMovies: ["Along the gods", "LOTR", "Oldboy"],
favFood: [
{
name: "k",
fatty: false
},
{
name: "C"
fatty: true
}
]
}
console.log(nicoInfo)
배열과 객체가 섞여 있다. 배열은 [], 객체는 {}이다.
'노마드 코더 > JavaScript' 카테고리의 다른 글
| Organizing Data with Arrays (0) | 2021.08.24 |
|---|---|
| Data Types on JS (0) | 2021.08.23 |
| let, const, var (0) | 2021.08.22 |
| Your first JS Variable(변수!) (0) | 2021.08.22 |
| Hello World with Javascript (0) | 2021.08.22 |
댓글
© 2021 wisdom