JavaScript -- Constructor、Prototype
2014-05-12 00:13
113 查看
----- 012-constructor.html -----
----- 011-prototype.html -----
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>标题</title> </head> <body> <script type="text/javascript"> document.write("0的构造者是:"); document.write((0).constructor); document.write("<br/>0的构造者==Number:"); document.write((0).constructor==Number); document.write("<br/><br/>字符串的构造者是:"); document.write("字符串".constructor); document.write("<br/>字符串的构造者==String:"); document.write("字符串".constructor==String); </script> </body> </html>
----- 011-prototype.html -----
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>标题</title> </head> <body> <script type="text/javascript"> function wo() { return "我是一个字符串<br/>"; } String.prototype.me = wo; var str = new String("000"); document.write(str.me()); </script> </body> </html>
相关文章推荐
- JavaScript中几个重要的属性(this、constructor、prototype)介绍
- JavaScript Object.prototype.constructor属性详解
- JavaScript中prototype、constructor、hasOwnProperty()、isPrototypeOf()学习笔记
- JavaScript精炼---类(class)、构造函数(constructor)、原型(prototype)
- Javascript中this、prototype、constructor的理解
- 彻底搞清javascript中this, constructor, prototype
- javascript之prototype&constructor
- javascript中的prototype和constructor
- [javascript基础]constructor与prototype
- JavaScript的原型链继承__propt__、prototype、constructor的理解、以及他们之间相互的关系。
- JavaScript:Object.constructor == Object.prototype.constructor 返回 false
- 关于JavaScript的prototype、__proto__、constructor、this
- JavaScript中的constructor、instanceof、isPrototypeOf、typeof以及hasOwnProperty
- JavaScript的constructor 、prototype解析 -- 原型模式知识扩展
- javascript中的 prototype, __proto__, constructor 与 原型继承链
- Javascript中this、prototype、constructor的理解
- 转载 在Javascript面向对象的编程中我们常常会见到这三个关键字:this、prototype、constructor。
- Prototype and Constructor in JavaScript
- JavaScript中constructor和prototype属性
- 【转】Javascript中prototype和constructor详解