js
This commit is contained in:
23
javascript/10对象.md
Normal file
23
javascript/10对象.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# 对象
|
||||
|
||||
## 创建
|
||||
|
||||
- new Object()
|
||||
- {}
|
||||
|
||||
## 使用
|
||||
|
||||
```javascript
|
||||
var obj = new Object()
|
||||
|
||||
// 创建属性
|
||||
|
||||
obj.name = "name"
|
||||
|
||||
// 动态操作属性
|
||||
|
||||
var name = 'age'
|
||||
obj[age] = 18;
|
||||
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user