当前位置:网站首页>6. Data agent object Defineproperty method
6. Data agent object Defineproperty method
2022-07-03 19:39:00 【Shura MIUI】
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
</body>
</html>
<script>
var number = 10;
//1
let person = {
name: ' Zhang San ',
sex: ' male '
};
// Defining attributes ,
Object.defineProperty(person, 'age', {
// value: 18,
enumerable: false, // When enumerable by false when age Properties cannot be enumerated ,
// writable:false,//false The attribute value cannot be modified
// configurable: false, //false Attributes cannot be deleted and defined set Method
// When accessing age Called when value get Method , When defining get When the method is used ,value and writable Don't define
// get: function() {
// return number;
// },
// When modifying age Execute when value set Method , When defining set When the method is used ,value、writable、configurable Not definable
set: function(value) {
console.log(' Someone modified it age attribute , value =>'+value);
number = value;// Yes age When modifying, assign a value to number
}
});
console.log(Object.keys(person));
// 0: "name"
// 1: "sex"
// length: 2
for (let key in person) console.log(person[key]);
// Zhang San
// male
//2
// The following age Attributes can be enumerated
person = {
name: ' Zhang San ',
sex: ' male ',
age: 18
};
console.log(Object.keys(person));
// 0: "name"
// 1: "sex"
// 2: "age"
for (let key in person) console.log(person[key]);
// Zhang San
// male
// 18
</script>
边栏推荐
- BOC protected tryptophan zinc porphyrin (Zn · TAPP Trp BOC) / copper porphyrin (Cu · TAPP Trp BOC) / cobalt porphyrin (cobalt · TAPP Trp BOC) / iron porphyrin (Fe · TAPP Trp BOC) / Qiyue supply
- Win10 share you don't have permission
- Web Security (VII) specific process of authentication with session cookie scheme
- PR 2021 quick start tutorial, material import and management
- 5- (4-nitrophenyl) - 10,15,20-triphenylporphyrin ntpph2/ntppzn/ntppmn/ntppfe/ntppni/ntppcu/ntppcd/ntppco and other metal complexes
- CesiumJS 2022^ 源码解读[7] - 3DTiles 的请求、加载处理流程解析
- Thesis study - 7 Very Deep Convolutional Networks for Large-Scale Image Recognition (3/3)
- Pecan - route
- Acquisition and transmission of parameters in automatic testing of JMeter interface
- [optics] vortex generation based on MATLAB [including Matlab source code 1927]
猜你喜欢

Valentine's Day - make an exclusive digital collection for your lover

Recommend a GIF processing artifact less than 300K - gifsicle (free download)

FPGA 学习笔记:Vivado 2019.1 工程创建

第一章:求奇因数代数和,求同吗小数和s(d, n),简化同码小数和s(d, n),拓广同码小数和s(d, n)

04 -- QT OpenGL two sets of shaders draw two triangles

2022-06-25 advanced network engineering (XI) IS-IS synchronization process of three tables (neighbor table, routing table, link state database table), LSP, cSNP, psnp, LSP

2022-07-02 网工进阶(十五)路由策略-Route-Policy特性、策略路由(Policy-Based Routing)、MQC(模块化QoS命令行)

原生表格-滚动-合并功能

2022-06-25 网工进阶(十一)IS-IS-三大表(邻居表、路由表、链路状态数据库表)、LSP、CSNP、PSNP、LSP的同步过程

第二章:4位卡普雷卡数,搜索偶数位卡普雷卡数,搜索n位2段和平方数,m位不含0的巧妙平方数,指定数字组成没有重复数字的7位平方数,求指定区间内的勾股数组,求指定区间内的倒立勾股数组
随机推荐
Using the visualization results, click to appear the corresponding sentence
The way to treat feelings
The space of C disk is insufficient, and the computer becomes stuck. Quickly expand the capacity of C disk to make the system more smooth
2022-06-30 網工進階(十四)路由策略-匹配工具【ACL、IP-Prefix List】、策略工具【Filter-Policy】
Merge K ascending linked lists
Day10 ---- 强制登录, token刷新与jwt禁用
I study database at station B (4): DQL
Zhang Fei hardware 90 day learning notes - personal record on day 6. Please see my personal profile / homepage for the complete record
Chapter 1: drinking soft drinks, step tariff calculation, step tariff calculation function, personal income tax, solving square root inequality, simplifying solving square root inequality, solving dem
Read the paper glodyne global topology preserving dynamic network embedding
Valentine's Day - make an exclusive digital collection for your lover
2022.2.14 Li Kou - daily question - single element in an ordered array
BUUCTF
2022-06-30 advanced network engineering (XIV) routing strategy - matching tools [ACL, IP prefix list], policy tools [filter policy]
[wallpaper] (commercially available) 70 wallpaper HD free
FPGA learning notes: vivado 2019.1 project creation
What is the content of game modeling
原生表格-滚动-合并功能
05 -- QT OpenGL draw cube uniform
Unittest framework is basically used