JS의 객체와 데이터 타입 (Learning JS)

Jeon곰탱·2021년 11월 22일
0

LearningJS

목록 보기
2/9

객체의 본질은 컨테이너

객체의 콘텐츠 Property or Member

const obj =  {}
obj.color = "yellow"
obj["not an Indenifier"] = 3

obj는 계속 같은 객체이며, 바뀐 것은 객체의 프로퍼티이다.

const sam = {
    name : `sam`,
    class : {
        kingdom : `Korea`,
        family : `Lee`,
    }
}
sam.class.family // lee
sam.class["family"] //lee
sam["class"].family //lee
sam["class"]["family"] //lee

sam.speak = function () {
    return "legend!"
}
delete sam.speak

Dangling comma, Terminal comma 는 끝부분에 붙히는것 (지향)


Data Type 변환

숫자로 바꾸기

Number(numStr)

Number
parseInt()
valueOf
toString
profile
Atomic habits make me

0개의 댓글