当前位置: 首页 > news >正文

iis新建网站不能访问东莞市区最繁华的地方

iis新建网站不能访问,东莞市区最繁华的地方,天猫淘宝优惠券网站怎么做,windows优化大师要钱class是ES6引入的#xff0c;它并不是一种全新的继承模式#xff0c;而只是基于原型对象继承封装的语法糖#xff0c;因此只要充分理解原型对象#xff0c;原型链#xff0c;继承等知识#xff0c;class也就很好容易理解了 类的声明 ES5及之前是通过创建一个构造函数(Fn)…class是ES6引入的它并不是一种全新的继承模式而只是基于原型对象继承封装的语法糖因此只要充分理解原型对象原型链继承等知识class也就很好容易理解了 类的声明 ES5及之前是通过创建一个构造函数(Fn)以及将方法指派到该构造函数的原型对象(Fn.prototype)上来创建一个类。 在ES6中类的声明就十分简单了只要以class关键字开始, 接上类名, 最后将方法编写在花括号{}里面。注意点方法之间不需要逗号方法之间不需要逗号方法之间不需要逗号 class Person {// 等价于 Person构造函数constructor(name) {this.name name;}// 等于Person.prototype.sayHellosayHello() {console.log(Hello, my name is ${this.name});} }let me new Person(mxk); console.log(me.name); // mxk console.log(me.sayHello()) // Hello, my name is mxkconsole.log(me instanceof Person) // true console.log(typeof Person) //function console.log(Object.getPrototypeOf(me) Person.prototype) // true console.log(Person.prototype.constructor Person) // true 类表达式 匿名函数表达式 let Person class {constructor(name) { this.name name; } } 具名函数表达式 let Person class Person1{constructor(name) { this.name name; } } 与函数的声明和表达式不同函数声明是会被提升的但是类的声明和表达式都不存在提升因此它们主要的不同就是代码风格 类的特点 类声明不会被提升这与函数定义不同。类声明的行为与 let 相似因此在程序的执行到达声明处之前类会存在于暂时性死区内。类声明中的所有代码会自动运行在严格模式下并且也无法退出严格模式。类的所有方法都是不可枚举的而自定义类创建的方法默认是可枚举的类的所有方法内部都没有 [[Construct]] 因此使用 new 来调用它们会抛出错误。调用类构造器时不使用 new 会抛出错误。不得修改类内部的类名模拟类的创建 let/*不会被提升*/ Person /*外部可以访问的*/ (function() {use strict; /*运行在严格模式下*/const /*不能修改内部的类名*/ Person1 function(name) {if (new.target void 0) {throw new Error(构造函数必须使用new);}this.name name;}Object.defineProperty(Person1.prototype, sayHello, {value: function() {if (new.target ! void 0) {throw new Error(类内方法调用不能使用new)}console.log(Hello, my name is ${this.name});},enumerable: false, /*类内所有的方法都是不可枚举的*/writable: true,configurable: true})return Person1; })(); 类的声明和表达式基本是一致的函数声明暴露给外部的类名和内部的类名是相同的类表达式的话只有赋值符号左边的类名是我们可以访问的右侧那个是内部的类名 立即调用类构造函数 let me new class {constructor(name) { this.name name; }sayHello() {console.log(Hello, my name is ${this.name});} }(mxk);console.log(me.name) // mxk console.log(me.sayHello()) // Hello, my name is mxk 使用这种模式你无法访问到类因为外部可以访问的类名它并没有暴露出来 访问器属性 class Person {constructor(name, age) {this.name name;this.__age age}get age() {return this.__age;}set age(value) {this.__age value 1;} } 相当于 Object.defineProperty(Person.prototype, age, {enumerable: false, /*不可枚举*/configurable: true,get() { return this.__age; },set(value) { this.__age value 1; } }) 静态成员 直接定义在构造函数对象上的方法实例对象无法访问到 class ClassType {constructor() {this.type class_type;}static create() {return new ClassType();} }let ct ClassType.create(); console.log(ct.type); //class_type console.log(ct.create); // undefined 转载于:https://www.cnblogs.com/guanine/p/9273098.html
http://www.pierceye.com/news/316290/

相关文章:

  • 你的网站尚未进行备案中国建设银行贵州分行网站
  • 白银做网站的董事wordpress模板搬迁
  • 专业的网站开发建访动地科技登录网站
  • 网站模板素材下载如何做二维码跳转到网站
  • 自助建站免费信息发布网站wordpress 做图库栏目
  • 做网站 我们的工人怎么写哪个网站可以做照片分享
  • 做娱乐网站一个服务器可以建几个网站
  • 外包加工网站企业邮箱免费注册申请
  • jsp网站开发模式徐州手机网站制作
  • 三合一网站开发架构怎么用dw设计网站页面
  • 资源分享网站怎么做临沂住房和城乡建设厅网站
  • 住房和城乡建设部官方网站办事大厅企业展厅设计公司信息
  • 公司网站设计单页网站怎么做排名
  • 公司产品网站应该怎么做页面模板第三方应用
  • 绍兴网站建设网站站长 网站对比
  • 廊坊哪里做网站好费用
  • 织梦建站教程wordpress支持mysqli
  • 松江醉白池网站建设投资公司设立条件
  • 杭州网络seo优化知识
  • 对网站的建议和优化网银汇款企业做网站用途写什么
  • 商务网站的功能和建设制作外贸网站模板
  • 如何防止网站挂黑链怎么购买国外的域名
  • 企业官方网站地址怎么填微信页面设计网站
  • 国外购物网站有哪些郑州网站搜索排名
  • seo网站优化推广费用装饰行业网站建设
  • idea的网站开发登录页面做网页的
  • 寻找大连网站建设wordpress换模板 seo
  • 二手房公司网站源码网站的维护步骤
  • 衡水企业网站建设公司wordpress 快速回复
  • 网站维护需要关闭网站么找哪些公司做网站