当前位置:网站首页>怎样删除对象的某个属性或⽅法
怎样删除对象的某个属性或⽅法
2022-07-03 13:23:00 【小喵喵丶】
使⽤ delete 关键字, 可以删除对象的属性或⽅法.
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
由上可知, 使⽤delete可以删除对象的属性或⽅法, 删除成功会返回 true, 对不存在的属性进⾏引⽤时会返回 undefined, 对不存在的⽅法进⾏
调⽤时会报错.
边栏推荐
- 太阳底下无新事,元宇宙能否更上层楼?
- GoLand 2021.2 configure go (go1.17.6)
- [bw16 application] instructions for firmware burning of Anxin Ke bw16 module and development board update
- IBEM mathematical formula detection data set
- Go language web development series 29: Gin framework uses gin contrib / sessions library to manage sessions (based on cookies)
- [556. Next larger element III]
- The latest BSC can pay dividends. Any B usdt Shib eth dividend destruction marketing can
- 静态链表(数组的下标代替指针)
- 栈应用(平衡符)
- Multi table query of MySQL - multi table relationship and related exercises
猜你喜欢

又一个行业被中国芯片打破空白,难怪美国模拟芯片龙头降价抛售了

Resource Cost Optimization Practice of R & D team

GoLand 2021.1.1: configure the multi line display of the tab of the open file

Complete DNN deep neural network CNN training with tensorflow to complete image recognition cases

Students who do not understand the code can also send their own token, which is easy to learn BSC

Box layout of Kivy tutorial BoxLayout arranges sub items in vertical or horizontal boxes (tutorial includes source code)

AI scores 81 in high scores. Netizens: AI model can't avoid "internal examination"!

物联网毕设 --(STM32f407连接云平台检测数据)

Ocean CMS vulnerability - search php

Unity EmbeddedBrowser浏览器插件事件通讯
随机推荐
MySQL functions and related cases and exercises
Unity render streaming communicates with unity through JS
Leetcode-1175.Prime Arrangements
IBEM 数学公式检测数据集
Asp. Net core1.1 without project JSON, so as to generate cross platform packages
IBEM mathematical formula detection data set
实现CNN图像的识别和训练通过tensorflow框架对cifar10数据集等方法的处理
ThreadPoolExecutor realizes multi-threaded concurrency and obtains the return value (elegant and concise way)
Richview trvstyle liststyle list style (bullet number)
Depth and breadth first traversal of tree (regardless of binary tree)
挡不住了,国产芯片再度突进,部分环节已进到4nm
JS convert pseudo array to array
物联网毕设 --(STM32f407连接云平台检测数据)
JSON serialization case summary
Mobile phones and computers can be used, whole people, spoof code connections, "won't you Baidu for a while" teach you to use Baidu
Several common optimization methods matlab principle and depth analysis
The reasons why there are so many programming languages in programming internal skills
Open PHP error prompt under Ubuntu 14.04
The principle of human voice transformer
Complete deep neural network CNN training with tensorflow to complete picture recognition case 2