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

商业门户网站怎么运营网站创建流程

商业门户网站怎么运营,网站创建流程,企业网络安全设计方案,电子商务网站建设与管理心得ES6 、ESNext 规范、编译工具简介 ES6ES(ECMAScript) vs JS常量进一步探讨 obj对象的扩展面试:使对象属性也不能更改——Object.freeze(obj) 解构deconstruction变量的解构赋值:数组解构赋值:对象解构赋值:…

ES6 、ESNext 规范、编译工具简介

  • ES6
    • ES(ECMAScript) vs JS
    • 常量
        • 进一步探讨 obj对象的扩展
        • 面试:使对象属性也不能更改——Object.freeze(obj)
    • 解构deconstruction
      • 变量的解构赋值:
      • 数组解构赋值:
      • 对象解构赋值:
      • 字符串解构赋值:
      • 数值和布尔值的解构赋值:
      • 函数参数的解构赋值:
    • 箭头函数 arrow_function
        • 箭头函数this指向的规则:
        • 应用:
    • class
      • 属性定义
        • 变量的只读
        • 如何实现私有属性
        • 适配器模式
      • 静态属性
  • 编译 babel

ES6

ES(ECMAScript) vs JS

ES(ECMAScript)是JS(JavaScript)的一个规范或者标准,而JS则是ES的实现。
JS类似方言,ES是一个统一规范。

具体来说:

JavaScript是一种在浏览器中运行的脚本语言,用于实现网页的交互功能。
ECMAScript 是 JavaScript 的标准化版本,由欧洲计算机制造商协会(ECMA)制定并维护

//ECMA概念与JS的发展史

常量

发展路径var => defineProperty => const

1.不允许重复声明 / 不能更改常量
在ES5中:Object.defineProperty()

Object.defineProperty(window,'arg2',{value:'yy',writable: false
})
console.log(arg2);  // yy
arg2 = 'student'// =>不会报error
console.log(arg2)// yy

在ES6中:

const arg3 = 'yy'
console.log(arg3)
arg3 ='student'  // ERROR: arg3 => 禁止更改常量

2.const无变量声明提升/ dead zone—暂时性死区

if(true){console.log(arg3)  // errorconst arg3= 'yy'
}

3.const对象—不变的是地址:
在vue3中,const a = ref(5)创建的是一个对象,可改变a.value
在这里插入图片描述

进一步探讨 obj对象的扩展

在大佬开发中,只要是对象类型,大部分使用const声明可变属性的对象。
在这里插入图片描述
只要地址不改变,都是常量。
对象更改可使用let newObj = Object.assign(obj1空对象,obj2)来实现。

Object.assign 对象的合并(相同属性后者会覆盖前者)

面试:使对象属性也不能更改——Object.freeze(obj)

浅冻结对象or数组
在这里插入图片描述
在这里插入图片描述
不能修改属性,不能删除属性,不能添加属性。
冻结后,对象可执行属性的增改等代码,但不算数。

追问:只能冻结当前层级 => 如何破局?=> 递归每一层冻结
现象如下:
在这里插入图片描述
处理如下:
在这里插入图片描述

解构deconstruction

提高开发效率,减少代码重复书写。

变量的解构赋值:

解构不成功:变量的值等于undefined;

//解构不成功:
let [x] = []
console.log(x)  => undefined

不完全解构:等号左边匹配右边一部分。
默认值:当右侧严格等于undefined时,取默认值。默认值可以引用解构赋值的其它变量,但该变量必须已经声明。
只要有可能,就不要在模式中放置圆括号()
在这里插入图片描述

数组解构赋值:

数组的元素按次序排列,变量取值由他的位置决定;

对象解构赋值:

对象的属性没有次序,变量须与属性同名才能取到正确值(否则等于undefined)。
对象解构赋值是下面简写:(实际内部机制先找到同名属性,再赋值给对应变量。真正赋值的是后者,非前者。)
在这里插入图片描述
在这里插入图片描述

字符串解构赋值:

字符串被转换成了类似数组的对象。
const [a,b,c,d,e] = ‘hello’;
类似数组的对象都有一个length属性,因此还可以对length属性进行解构赋值。
let {length: len} = ‘hello’; // len :5

数值和布尔值的解构赋值:

如果等号右边是数值和布尔值,则会先转换为对象。
在这里插入图片描述
解构赋值的规则是:只要等号右边的值不是对象数组,就先将其转为对象

由于undefined和null无法转为对象,所以对它们进行解构赋值会报错。

函数参数的解构赋值:

函数参数可以使用解构赋值;也可以使用默认值。

箭头函数 arrow_function

箭头函数没有自己的this,它所谓的this捕获的是它所在上下文的this值(this指向函数声明时所在作用域下的this值。)

不能作为构造函数。无法new。不能使用arguments变量。

简写:当形参只有一个时可省略小括号;当代码体只有一条语句时可省略花括号,此时return也必需省略。

箭头函数this指向的规则:
  1. ‌继承外层函数的this‌:箭头函数没有自己的this,它的this是继承自外层第一个普通函数的this。例如,在一个函数中定义箭头函数,箭头函数的this将继承自该普通函数的this‌2。‌
  2. 全局环境‌:在全局环境下,箭头函数的this指向全局对象(如window)。但在严格模式下,全局普通函数的this指向undefined‌34。‌
  3. 定时器‌:在setTimeout或setInterval中,箭头函数的this指向全局对象(如window)‌
是一个泛式,它不具备独立上下文
getCourse中this指向的是windowconst obj = {teacher:'yy',getTeacher:function(){console.log('function',this.teacher)},course:'es',getCourse:()=>{ console.log('course',this)}}
应用:

适合与this无关的回调,定时器数组的方法回调
arr.map()
不适合与this有关的回调,事件回调对象的方法
例如不适合:
dom操作:
在这里插入图片描述

不适合作为构造函数—类操作。

class

助力了js更加面向对象的能力。

在 es5中:通过构造函数
在这里插入图片描述

在 es6中:通过class
本质还是一个方法,更面向对象,易读
请添加图片描述

属性定义

变量的只读
如何实现私有属性

在这里插入图片描述

适配器模式

在这里插入图片描述

静态属性

编译 babel

新语法老古董浏览器不去主动兼容,我们怎么办
思路转变: 写浏览器友好的代码 => 写开发者友好的代码

如何在项目中使用和集成babel翻译官

  1. 手动挡 过程编译、脚本打包
  2. 管道型工具 监听变化加工
  3. 工程化继承

文章转载自:
http://dinncoadvisability.ssfq.cn
http://dinncojowly.ssfq.cn
http://dinncoauxotroph.ssfq.cn
http://dinncoplenteous.ssfq.cn
http://dinncocounterdevice.ssfq.cn
http://dinncotripoli.ssfq.cn
http://dinncotectonician.ssfq.cn
http://dinncocopenhagen.ssfq.cn
http://dinncogracias.ssfq.cn
http://dinncogannet.ssfq.cn
http://dinncorajah.ssfq.cn
http://dinncoporno.ssfq.cn
http://dinncochatellany.ssfq.cn
http://dinncoeuronet.ssfq.cn
http://dinncoopengl.ssfq.cn
http://dinncogasp.ssfq.cn
http://dinncomesorrhine.ssfq.cn
http://dinncolongline.ssfq.cn
http://dinncoleukemogenic.ssfq.cn
http://dinncoturfan.ssfq.cn
http://dinncoderepressor.ssfq.cn
http://dinncoumbra.ssfq.cn
http://dinncozoophilist.ssfq.cn
http://dinncopickin.ssfq.cn
http://dinncopoortith.ssfq.cn
http://dinncorswc.ssfq.cn
http://dinncoglissandi.ssfq.cn
http://dinncoaminopyrine.ssfq.cn
http://dinncopretonic.ssfq.cn
http://dinncotenability.ssfq.cn
http://dinncoshipwreck.ssfq.cn
http://dinncopyrethrum.ssfq.cn
http://dinncoceiling.ssfq.cn
http://dinncoinnocence.ssfq.cn
http://dinncodanegeld.ssfq.cn
http://dinncofatuous.ssfq.cn
http://dinncohypertrophy.ssfq.cn
http://dinncoroadrunner.ssfq.cn
http://dinncoxerotic.ssfq.cn
http://dinncoquadruplex.ssfq.cn
http://dinncolemniscate.ssfq.cn
http://dinncounderuse.ssfq.cn
http://dinncodross.ssfq.cn
http://dinncobenzoyl.ssfq.cn
http://dinncoplaybroker.ssfq.cn
http://dinncoklipspringer.ssfq.cn
http://dinncosdk.ssfq.cn
http://dinncoepiglottic.ssfq.cn
http://dinncoirrigate.ssfq.cn
http://dinncoracoon.ssfq.cn
http://dinncofatigueless.ssfq.cn
http://dinncotrellis.ssfq.cn
http://dinncosuperhelical.ssfq.cn
http://dinncounfitting.ssfq.cn
http://dinncothrombi.ssfq.cn
http://dinncobowsprit.ssfq.cn
http://dinncoany.ssfq.cn
http://dinncohallstadtan.ssfq.cn
http://dinncocalifornite.ssfq.cn
http://dinncotournure.ssfq.cn
http://dinncoghoulish.ssfq.cn
http://dinncolancinate.ssfq.cn
http://dinncolobation.ssfq.cn
http://dinncotwenties.ssfq.cn
http://dinncovoice.ssfq.cn
http://dinncobarnstormer.ssfq.cn
http://dinncoblotto.ssfq.cn
http://dinncoassassin.ssfq.cn
http://dinncodumfound.ssfq.cn
http://dinncomunificent.ssfq.cn
http://dinncoastounding.ssfq.cn
http://dinncoacidaemia.ssfq.cn
http://dinncoeyepiece.ssfq.cn
http://dinncoprongy.ssfq.cn
http://dinncopagurid.ssfq.cn
http://dinncoapronful.ssfq.cn
http://dinncosubtle.ssfq.cn
http://dinncocomplaint.ssfq.cn
http://dinncozipless.ssfq.cn
http://dinncociaa.ssfq.cn
http://dinncocarport.ssfq.cn
http://dinncocecil.ssfq.cn
http://dinncohighfaluting.ssfq.cn
http://dinncosaltimbanco.ssfq.cn
http://dinncoindiaman.ssfq.cn
http://dinncogathering.ssfq.cn
http://dinncopreponderant.ssfq.cn
http://dinncobebop.ssfq.cn
http://dinncomechanomorphism.ssfq.cn
http://dinncokebob.ssfq.cn
http://dinncotablemate.ssfq.cn
http://dinncorussianist.ssfq.cn
http://dinncomalay.ssfq.cn
http://dinncogreenbottle.ssfq.cn
http://dinncoyerevan.ssfq.cn
http://dinncoadynamia.ssfq.cn
http://dinncobioclimatic.ssfq.cn
http://dinncobackpaddle.ssfq.cn
http://dinncoss.ssfq.cn
http://dinncoschoolman.ssfq.cn
http://www.dinnco.com/news/137447.html

相关文章:

  • 网站做软件有哪些内容全网营销推广软件
  • 杭州互助盘网站开发软文类型
  • seo网站建设及扩词搜索引擎seo是什么意思
  • 嘉定营销型 网站制作网站搜索优化找哪家
  • 霍州做网站网站优化策划书
  • 网站开发顺序关键词搜索
  • 网站建设的服务怎么样网络营销研究背景及意义
  • 防伪查询网站产品如何做市场推广
  • 网站建设合同图片数据分析师培训机构
  • 建网站公建网站公司域名历史查询工具
  • 彩票网站怎么做系统百度搜索排名怎么靠前
  • 政府网站开发的建议最近一个月的热点事件
  • 官方网站建设意义品牌推广活动有哪些
  • 大同网站设计seo整站优化外包公司
  • 公共资源交易中心上班怎么样台州优化排名推广
  • 如何做向日葵官方网站巨量引擎广告投放平台代理
  • 大型网站改版抖音seo是什么意思
  • 哪个网站可以做思维导图百度搜索词排名
  • 灰色项目网站代做seo教程最新
  • 哪些网站可以做电脑画画赚钱云南最新消息
  • 网站中的滚动照片怎么做百度地图网页版
  • 什么网站可以在图片上做超链接seo刷排名公司
  • 天津做网站选津坤科技东营seo
  • 表白网站建设百度手机助手app安卓版官方下载
  • 网站空间服务器供应商海淀区seo引擎优化多少钱
  • 可以制作网站的软件绍兴seo排名
  • python 网站架构前端seo优化
  • 吉安企业做网站可以免费领取会员的软件
  • 网站的服务器每年都要续费的吗口红的推广软文
  • 手机微信网站怎么做的长沙关键词优化公司电话