当前位置:网站首页>How to delete an attribute or method of an object
How to delete an attribute or method of an object
2022-07-03 13:58:00 【Little meow, meow】
send ⽤ delete keyword , You can delete the attributes of an object or ⽅ Law .
var obj = {
};
obj.name; // undefined;
obj.name = "Lilei";
obj.name; // "Lilei"
obj.sayHello = function () {
console.log("hello") };
obj.sayHello(); // "Hello";
delete obj.name; // true
delete obj.sayHello; // true;
obj.name; // undefined;
obj.sayHello(); // Error: undefined
It can be seen from the above that , send ⽤delete You can delete the attributes of an object or ⽅ Law , If the deletion is successful, it will return true, For non-existent attributes ⾏ lead ⽤ Will return to undefined, Yes, it doesn't exist ⽅ Fajin ⾏
transfer ⽤ When an error .
边栏推荐
- Shell timing script, starting from 0, CSV format data is regularly imported into PostgreSQL database shell script example
- Golang — 命令行工具cobra
- Golang - command line tool Cobra
- SQL Injection (POST/Search)
- 3D视觉——2.人体姿态估计(Pose Estimation)入门——OpenPose含安装、编译、使用(单帧、实时视频)
- Go language web development series 26: Gin framework: demonstrates the execution sequence of code when there are multiple middleware
- 金属有机骨架材料ZIF-8包载姜黄素([email protected]纳米颗粒)|纳米金属有机框架搭载雷帕霉素|科研试剂
- Spring cup eight school league
- MySQL data processing value addition, deletion and modification
- 使用vscode查看Hex或UTF-8编码
猜你喜欢
Go language web development series 27: Gin framework: using gin swagger to implement interface documents
RocksDB LRUCache
Qt学习24 布局管理器(三)
Cross linked cyclodextrin metal organic framework loaded methotrexate slow-release particles | metal organic porous material uio-66 loaded with flavonoid glycosides | Qiyue
Qt学习22 布局管理器(一)
消息订阅与发布
Failure of vector insertion element iterator in STL
Summary of common error reporting problems and positioning methods of thrift
NFT新的契机,多媒体NFT聚合平台OKALEIDO即将上线
The solution of Chinese font garbled code in keil5
随机推荐
金属有机骨架(MOFs)抗肿瘤药载体|PCN-223装载甲硝唑|UiO-66包载盐酸环丙沙星([email protected])
Folic acid modified metal organic framework (zif-8) baicalin loaded metal organic framework composite magnetic material (AU- [email
Universal dividend source code, supports the dividend of any B on the BSC
pytorch 载入历史模型时更换gpu卡号,map_location设置
Software testing is so hard to find, only outsourcing offers, should I go?
Go language web development series 28: solve cross domain access of CORS with gin contrib / CORS
使用vscode查看Hex或UTF-8编码
Doxorubicin loaded on metal organic framework MIL-88 DOX | folic acid modified uio-66-nh2 doxorubicin loaded [email
[combinatorics] permutation and combination (examples of combinatorial number of multiple sets | three counting models | selection problem | combinatorial problem of multiple sets | nonnegative intege
树的深入和广度优先遍历(不考虑二叉树)
Go language web development series 26: Gin framework: demonstrates the execution sequence of code when there are multiple middleware
Go language web development series 30: gin: grouping by version for routing
【吉林大学】考研初试复试资料分享
Solve MySQL 1045 access denied for user 'root' @ 'localhost' (using password: yes)
SQL Injection (AJAX/JSON/jQuery)
28:第三章:开发通行证服务:11:在配置文件中定义属性,然后在代码中去获取;
Stack application (balancer)
SQL Injection (GET/Select)
Selenium browser (1)
Go 1.16.4: manage third-party libraries with Mod