当前位置:网站首页>JS implementation private attribute
JS implementation private attribute
2022-04-23 17:41:00 【KK should continue to work hard】
JS Implement private properties
- Based on closure
function P(name){
var _name = name;
this.getName=function(){
return _name;
}
}
var p = new P("xxx");
console.log(p._name); //undefined
console.log(p.getName()); //xxx
版权声明
本文为[KK should continue to work hard]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230551363620.html
边栏推荐
- Seven cattle upload pictures (foreground JS + background C API get token)
- 958. Complete binary tree test
- 開期貨,開戶雲安全還是相信期貨公司的軟件?
- [logical fallacy in life] Scarecrow fallacy and inability to refute are not proof
- 239. 滑动窗口最大值(困难)-单向队列、大顶堆-字节跳动高频题
- .Net Core3. 1 use razorengine NETCORE production entity generator (MVC web version)
- In embedded system, must the program code in flash be moved to ram to run?
- 1217_使用SCons生成目标文件
- MySQL installation
- 基于51单片机红外无线通讯仿真
猜你喜欢
48. Rotate image
嵌入式系统中,FLASH中的程序代码必须搬到RAM中运行吗?
Tdan over half
flink 学习(十二)Allowed Lateness和 Side Output
Matlab / Simulink simulation of double closed loop DC speed regulation system
Kubernetes service discovery monitoring endpoints
SystemVerilog(六)-变量
MySQL installation
Qt error: /usr/bin/ld: cannot find -lGL: No such file or directory
Why do some people say SCM is simple and I have to learn it so hard?
随机推荐
Using quartz under. Net core - calendar of [6] jobs and triggers
Header built-in object
Ouvrir des contrats à terme, ouvrir des comptes en nuage ou faire confiance aux logiciels des sociétés à terme?
ros常用的函数——ros::ok(),ros::Rate,ros::spin()和ros::spinOnce()
402. 移掉 K 位数字-贪心
C dapper basically uses addition, deletion, modification and query transactions, etc
Self use learning notes - connectingstring configuration
How to change input into text
[WPF binding 3] listview basic binding and data template binding
开期货,开户云安全还是相信期货公司的软件?
QT modification UI does not take effect
92. 反转链表 II-字节跳动高频题
Matlab / Simulink simulation of double closed loop DC speed regulation system
Summary of common SQL statements
Advantages and disadvantages of several note taking software
古代埃及希腊,数学用的什么进制
198. Looting - Dynamic Planning
Sword finger offer 22 The penultimate node in the linked list - speed pointer
Clickhouse SQL operation
[related to zhengheyuan cutting tools]