`
nicegege
  • 浏览: 580161 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

ECMAScript的Object类

 
阅读更多

1.ECMAScript中的object类与java里的java.lang.object类相似,所有类都继承他而来的。Object类中的属性和方法都会出现在其他类中,所以理解了Object类,就可以更好的理解其他类。

Object类具有以下属性:

Constructor:对创建对象的函数的引用(指针),对于Object类,该指针指向原始的object()函数

Prototype:对该对象的对象模型的引用,对于所有的类,它默认返回Object对象的一个实例。

Object类的方法:

HasOwnProperty(property):判断对象是否有某个特定的属性。必须用字符串指定该属性

(例如,o.hasOwnProperty("name")).

IsPrototypeOf(object):判断该对象是否为另一个对象的模型

PropertyIsEnumerable(property):判断给定的属性是否可以用for...in语句进行枚举。

ToString():返回对象的原始字符串表示。对于Object类,ECMA-262没有定义这个值,所以不同的ECMAScript实现有不同的值。

ValueOf():返回最适合该对象的原始值。对于许多类,该方法返回的值都与toString()的返回值相同。

上面列出的每种属性和方法都会被其他类覆盖。

分享到:
评论

相关推荐

    Using the Excel Services ECMAScript Object Model.docx

    Moss 2010 for how to use Excel Services ECMAScript Object Model

    ecmascript-object-observe:ECMAScript Object.observe规范

    ecmascript-object-observe ECMAScript Object.observe规范建议 可读规范位于 。 此规范提案使用来生成HTML运行 npm install -g ecmarkdown mkdir out ecmarkdown spec/index.html out/index.html cp css/elements...

    proposal-object-rest-spread, ECMAScript的rest/扩展属性.zip

    proposal-object-rest-spread, ECMAScript的rest/扩展属性 对象的对象 rest/扩展属性ECMAScript 6为 array literals分配了 rest元素和扩展元素( 用于 array 文本。这个建议引入了类似的rest属性对象literals分配和...

    ECMAScript 2018规范

    ECMAScript 2018规范。 主要包含内容: 异步迭代器:原生支持在 JavaScript 中对异步获取的数据做迭代。 Object Rest/Spread Properties Promise.prototype.finally Template Literal(模板字面量):取消 ...

    [ASP.NET Ajax] ECMAScript基础类以及Asp.net Ajax对类lt;Objectgt;的扩展

    在.NET中所有类都是继承自Object,同样在JS中也一样说有都继承Object,因此如果对Object进行了扩展,那所有继承Object类的后代肯定会拥有祖先的血缘。 既然开始学习JavaScript那就顺便在这里提一提他的原始数据类型,...

    《JavaScript高级程序设计》阅读笔记(三) ECMAScript中的引用类型

    ECMAScript中的引用类型,主要包括Object类、Boolean类、Number类、String类、instanceof运算符

    ECMAScript的Object.has()建议-JavaScript开发

    建议使用Object.has()方法以使Object.prototype.hasOwnProperty()更易于访问。 Object.has()关于Object.has()方法的建议,以使Object.prototype.hasOwnProperty()更易于访问。 状态此提案尚未引入TC39。 ...

    Packt.Object-Oriented.JavaScript.3rd.Edition

    About This Book This book has been updated to cover all the new object-oriented features introduced in ECMAScript 6 It makes object-oriented programming accessible and understandable to web ...

    Understanding ECMAScript 6

    Zakas provides a complete guide to the object types, syntax, and other exciting changes that ECMAScript 6 brings to JavaScript. Every chapter is packed with example code that works in any JavaScript ...

    Understanding.ECMAScript.6.159327757

    Zakas provides a complete guide to the object types, syntax, and other exciting changes that ECMAScript 6 brings to JavaScript. Every chapter is packed with example code that works in any JavaScript ...

    object-create-shim:ECMAScript 5 Object.create 的简单垫片

    对象创建垫片ECMAScript 5 Object.create简单垫片安装安装: npm install -g component然后: component install gamtiq/object-create-shim用法 var create = require("object-create-shim");...var obj1 = Object....

    ECMAscript2018规范

    资源名称:ECMAscript2018规范内容简介:ECMAscript 2018(第九版 JS)已于 6 月底正式发布,带来了许多新特性。...Object Rest/Spre 资源太大,传百度网盘了,链接在附件中,有需要的同学自取。

    besen-master_delphi_inchknf_ECMAScript_

    ECMAScript Fifth Edition Implemention in Object Pascal

    proposal-object-has:ECMAScript的Object.has()建议

    Object.has() 建议使用Object.has()方法以使Object.prototype.hasOwnProperty()更易于访问。 地位 这项建议尚未引入TC39。 作者: (Jamie Kyle,Discord) 冠军: (Tierney ,微软) 幻灯片: 动机 如今,...

    ECMAScript 6 Succinctly

    Enhanced Object Proprties Arrow Functions Extended Parameter Handling Template Literals Destructuring Assignment Modules Classes Iterators Generators Map, Set Symbols Promises Proxies Reflect API Tail...

    Javascript.Object.Oriented.Programming.pdf

    Chapter 7: Ecmascript 6 Chapter 8: Dom Manipulation And Events Chapter 9: Server-Side Javascript Chapter 10: Objects Everywhere Chapter 11: Classes And Instances Chapter 12: Encapsulation Of Data ...

    ECMAScript6新增值比较函数Object.is

    主要介绍了ECMAScript6新增值比较函数Object.is的相关资料,需要的朋友可以参考下

    Learning ECMAScript 6(PACKT,2015)

    ECMAScript 6 is the new edition to the ECMAScript language, whose specifications are inherited by JavaScript. ES6 gives a vast makeover to JavaScript by adding new syntaxes and APIs to write complex ...

    Object Oriented JavaScript(PACKT,3ed,2017)

    About This Book This book has been updated to cover all the new object-oriented features introduced in ECMAScript 6 It makes object-oriented programming accessible and understandable to web ...

Global site tag (gtag.js) - Google Analytics