当前位置:网站首页>Using closures to implement private variables
Using closures to implement private variables
2022-07-01 09:18:00 【su27_ 0101】
stay js Does not exist in the private Definition of private variables , But closures can be used to simulate
var getter, setter;
(function(){
var privateA = 0;
getter = function(){
return privateA;
};
setter = function(newVal){
if(typeof newVal != 'number'){
throw new Error(" No number")
}
privateA = newVal;
}
})();
边栏推荐
- 2.3 [pytorch] data preprocessing torchvision datasets. ImageFolder
- Design and manufacture of simple digital display electronic scale
- Which method is good for the management of fixed assets of small and medium-sized enterprises?
- [ESP nanny level tutorial] crazy completion chapter - Case: temperature and humidity monitoring system based on Alibaba cloud, applet and Arduino
- 2.3 【pytorch】数据预处理 torchvision.datasets.ImageFolder
- 【pytorch】transforms. Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))
- js this丢失问题分析 及 解决方案
- 【电赛训练】红外光通信装置 2013年电赛真题
- Principles of Microcomputer - Introduction
- 美团2022年机试
猜你喜欢
[video game training] real topic of 2013 video game of infrared optical communication device
Microcomputer principle - bus and its formation
2.3 【kaggle数据集 - dog breed 举例】数据预处理、重写Dataset、DataLoader读取数据
【pytorch】nn. Crossentropyloss() and nn NLLLoss()
2022.02.15_ Daily question leetcode six hundred and ninety
【检测技术课案】简易数显电子秤的设计与制作
2.2 【pytorch】torchvision.transforms
Error org apache. catalina. core. StandardContext. FilterStart start filter exception
Ranking list of domestic databases in February, 2022: oceanbase regained the "three consecutive increases", and gaussdb is expected to achieve the largest increase this month
NoSQL数据库的安装和使用
随机推荐
2.3 [kaggle dataset - dog feed example] data preprocessing, rewriting dataset, dataloader reading data
Short circuit operator lazy evaluation
Key points of NFT supervision and overseas policies
nacos簡易實現負載均衡
【ESP 保姆级教程】疯狂毕设篇 —— 案例:基于阿里云、小程序、Arduino的温湿度监控系统
Shell script - string
SDN_ Simple summary
小鸟识别APP
The jar package embedded with SQLite database is deployed by changing directories on the same machine, and the newly added database records are gone
Serialization, listening, custom annotation
Graduation season, I want to tell you
How to realize the usage of connecting multiple databases in idel
How to manage fixed assets well? Easy to point and move to provide intelligent solutions
Yidian Yidong helps enterprises to efficiently manage equipment and improve equipment utilization
Shell script -for loop and for int loop
Record a redis timeout
Redis source code learning (29), compressed list learning, ziplist C (II)
【pytorch】nn. Crossentropyloss() and nn NLLLoss()
Redis——Lettuce连接redis集群
tensorrt yolov5_ trt. Py comments