JS Objects

Heewon👩🏻‍💻·2024년 4월 23일

Object(객체)

Object : human

Property : name, height, weight, interest ...

프로퍼티를 가진 데이터를 저장시켜주는게 "객체"이다.
const human = {
	name: "Heewon",
    height: 167,
    weight: "secret",
    interest: "coding",
}

console.log(human.name);
console.log(human(["name"]);

//객체 안에 내용을 추가하고 싶으면 그냥..아래와 같이 작성하면 끝남.

human.personality = "kind";
console.log(human);

Object 와 Array 의 차이점

objectarray
property 유무ox
console 출력방법object.propertyvariable[index]
내용추가방법object.newpropertyname = contentsvariable.push = contents
profile
Interested in coding, meat lover, in love with dogs , enjoying everything happens in my life.

0개의 댓글