标签:style blog color java ar strong for 数据 div
1.对象的属性
ECMAScript中有两种属性:数据属性和访问器属性。
1)数据属性:有4个描述其行为的特性。
var person = {}; alert(typeof person); //object Object.defineProperty(person,"name",{ writable:false, value:"Yoyo" }); alert(person.name); //Yoyo person.name = "Anne"; alert(person.name); //Yoyo
var person = {}; alert(typeof person); //object Object.defineProperty(person,"name",{ writable:true, value:"Yoyo" }); alert(person.name); //Yoyo person.name = "Anne"; alert(person.name); //Anne
var person = {}; Object.defineProperty(person,"name",{ configurable:false, value:"Yoyo" }); alert(person.name); //Yoyo delete(person.name); alert(person.name); //Yoyo
var person = {}; Object.defineProperty(person,"name",{ configurable:true, value:"Yoyo" }); alert(person.name); //Yoyo delete(person.name); alert(person.name); //undefined
JavaScript学习笔记(七)----面向对象的程序设计
标签:style blog color java ar strong for 数据 div
原文地址:http://www.cnblogs.com/yanyangbyou/p/3958750.html