Skip to content

Object属性 #35

@yongheng2016

Description

@yongheng2016

.点运算符后面总跟字符串

obj.name
obj.age

[ ]中跟变量、字符串或Symbol(Symbol作为对象属性只能用[ ])

let s = 'name'
obj[s] == obj.name
--------------------------
obj['name']
--------------------------
let w = Symbol('name')
obj[w]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions