ES7 新特性 ------ includes 和 **

简介: ES7 新特性 ------ includes 和 **

includes

包含返回 true,不包含返回 false

  const classic = ['西游记','红楼梦','三国演义','水浒传']
    console.log(classic.includes('西游记')) //true
    console.log(classic.includes('活着'))// false

x**y

x 的 y 次方

console.log( 2 ** 10) // 1024

等价于

console.log(Math.pow(2,10)) // 1024


相关文章
|
3月前
|
JavaScript
【TS】You are currently running a version of TypeScript which is not officially supported by @typesc
【TS】You are currently running a version of TypeScript which is not officially supported by @typesc
93 2
|
JavaScript
ES6----ES6模块化
ES6----ES6模块化
打包报错Error: ‘default‘ is not exported by node_modules/qs/lib/index.js
打包报错Error: ‘default‘ is not exported by node_modules/qs/lib/index.js
239 0
|
JavaScript 前端开发
ES6 ------ 基础(五)
ES6 ------ 基础(五)
|
网络架构
ES6 ------ 基础(一)
ES6 ------ 基础(一)
|
JavaScript
Vue+TS/Typescript:Property does not exist on type ‘(() => any) | ComputedOptions<any>‘
Vue+TS/Typescript:Property does not exist on type ‘(() => any) | ComputedOptions<any>‘
259 0