当前位置:网站首页>Object.defineProperty方法、数据代理
Object.defineProperty方法、数据代理
2022-07-23 13:15:00 【斯文~】
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>回顾Object.defineproperty方法</title>
</head>
<body>
<script type="text/javascript" > let number = 18 let person = {
name:'张三', sex:'男', } Object.defineProperty(person,'age',{
// value:18, // enumerable:true, //控制属性是否可以枚举,默认值是false // writable:true, //控制属性是否可以被修改,默认值是false // configurable:true //控制属性是否可以被删除,默认值是false //当有人读取person的age属性时,get函数(getter)就会被调用,且返回值就是age的值 get(){
console.log('有人读取age属性了') return number }, //当有人修改person的age属性时,set函数(setter)就会被调用,且会收到修改的具体值 set(value){
console.log('有人修改了age属性,且值是',value) number = value } }) // console.log(Object.keys(person)) console.log(person) </script>
</body>
</html>
边栏推荐
- MySQL multi table query_ Inner connection_ Show internal connections
- Visualization of gross domestic product (GDP) data
- pytest接口自动化测试框架 | 控制测试用例执行
- TOPSIS法(MATLAB)
- Summary of after class homework of Microcomputer Principle and technical interface
- 精确的目标检测中定位置信度的获取
- 微机原理与技术接口课后作业总结
- RISC-V基金会董事谭章熹:RISC-V,从边缘逐渐向中央扩展
- Introduction to Huawei's new version of datacom certification
- 【笔记】线性回归
猜你喜欢

微机原理与技术接口课后作业总结

阿里平头哥CPU技术生态负责人陈炜:平头哥的发展之路

COPU副主席刘澎:中国开源在局部领域已接近或达到世界先进水平

Numpy 数据分析基础知识第一阶段(NumPy基础)

卷积神经网络模型之——GoogLeNet网络结构与代码实现

(已解决)idea编译Gradle项目提示 错误找不到符号
![[2022 freshmen learning] key points of the second week](/img/5f/87a30e898b4450af5f2eb0cf77e035.png)
[2022 freshmen learning] key points of the second week
![[C language] structure, enumeration and union](/img/18/3d9c511950cbcbd109df3104fbe248.png)
[C language] structure, enumeration and union

RISC-V基金会董事谭章熹:RISC-V,从边缘逐渐向中央扩展

Bag of Tricks for Image Classification with Convolutional Neural Networks(卷积神经网络在图像分类中的技巧)
随机推荐
Network protocol and attack simulation: Wireshark use, ARP Protocol
Talk about the memory layout of JVM
Introduction to Huawei's new version of datacom certification
Go 接口:深入内部原理
48:第五章:开发admin管理服务:1:创建子工程【imooc-news-dev-service-admin】,管理服务模块;
使用“soup.h1.text”爬虫提取标题会多一个\
mysql如何查询不在数据库里的数据?
Fastadmin, non super administrator, has been granted batch update permission, but it still shows no permission
通用分页功能
FreeRTOS个人笔记-挂起/解挂任务
20220721 beaten content
The working principle of PLL. For example, how can our 8MHz crystal oscillator make MCU work at 48mhz or 72mhz
The first stage of basic knowledge of numpy data analysis (numpy Foundation)
单片机内部IO口保护电路及IO口电气特性以及为什么不同电压IO之间为什么串联一个电阻?
Priyanka Sharma, general manager of CNCF Foundation: read CNCF operation mechanism
anchor free yolov1
Study note 7 -- traffic environment behavior prediction
百度编辑器上传图片设置自定义目录
[note] linear regression
Circuit structure and output mode of GPIO port of 32-bit single chip microcomputer