当前位置:网站首页>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
- SQL Injection (GET/Search)
- C language standard IO function sorting
- Go language web development series 30: gin: grouping by version for routing
- [技術發展-24]:現有物聯網通信技術特點
- selenium 浏览器(1)
- Go language web development series 28: solve cross domain access of CORS with gin contrib / CORS
- 项目协作的进度如何推进| 社区征文
- Formation of mil-100 (FE) coated small molecule aspirin [email protected] (FE) | glycyrrhetinic acid modified metal organ
- Common network state detection and analysis tools
猜你喜欢
RocksDB LRUCache
SQL Injection (AJAX/JSON/jQuery)
挡不住了,国产芯片再度突进,部分环节已进到4nm
Qt学习25 布局管理器(四)
Uniapp tips - scrolling components
SQL Injection (POST/Search)
3D vision - 2 Introduction to pose estimation - openpose includes installation, compilation and use (single frame, real-time video)
【吉林大学】考研初试复试资料分享
Implementation of Muduo accept connection, disconnection and sending data
可编程逻辑器件软件测试
随机推荐
金属有机骨架(MOFs)抗肿瘤药载体|PCN-223装载甲硝唑|UiO-66包载盐酸环丙沙星([email protected])
JS general form submission 1-onsubmit
掌握Cypress命令行选项,是真正掌握Cypress的基础
Stack application (balancer)
Installation impression notes
全面发展数字经济主航道 和数集团积极推动UTONMOS数藏市场
1px problem of mobile terminal
Go language unit test 4: go language uses gomonkey to test functions or methods
Sequence table (implemented in C language)
jvm-运行时数据区
NFT新的契机,多媒体NFT聚合平台OKALEIDO即将上线
Disruptor -- a high concurrency and high performance queue framework for processing tens of millions of levels
Uniapp skills - dom display and hiding
Golang — template
Leetcode-1175. Prime Arrangements
【BW16 应用篇】安信可BW16模组与开发板更新固件烧录说明
28:第三章:开发通行证服务:11:在配置文件中定义属性,然后在代码中去获取;
Logback log sorting
Another industry has been broken by Chinese chips. No wonder the leading analog chip companies in the United States have cut prices and sold off
Go language unit test 5: go language uses go sqlmock and Gorm to do database query mock