当前位置:网站首页>Es2016 key summary
Es2016 key summary
2022-06-30 04:10:00 【Runqing】
1.Array.prototype.includes
before:
Use Array.prototype.indexOf() To determine whether the array contains an element , Because this method returns the first index of a given element that can be found in the array , If it doesn't exist , Then return to -1.
const beasts = ['ant', 'bison', 'camel', 'duck', 'bison'];
console.log(beasts.indexOf('bison'));
// expected output: 1
// start from index 2
console.log(beasts.indexOf('bison', 2));
// expected output: 4
console.log(beasts.indexOf('giraffe'));
// expected output: -1
after:
Array.prototype.includes() Method is used to determine whether an array contains a specified value , According to the circumstances , Return if included true, Otherwise return to false.
const array1 = [1, 2, 3];
console.log(array1.includes(2));
// expected output: true
const pets = ['cat', 'dog', 'bat'];
console.log(pets.includes('cat'));
// expected output: true
console.log(pets.includes('at'));
// expected output: false
2. Index of operation
before:
Math.pow() Function returns cardinality (base) The index of (exponent) The next power , namely baseexponent.
console.log(Math.pow(7, 3));
// expected output: 343
console.log(Math.pow(4, 0.5));
// expected output: 2
console.log(Math.pow(7, -2));
// expected output: 0.02040816326530612
// (1/49)
console.log(Math.pow(-7, 0.5));
// expected output: NaN
after:
Use **
console.log(7 ** 3)
// expected output: 343
console.log(4 ** 0.5)
// expected output: 2
console.log(7 ** -2)
// expected output: 0.020408163265306124
console.log((-7) ** 0.5)
// expected output: NaN
边栏推荐
- Idea grey screen problem
- An error occurs when sqlyog imports the database. Please help solve it!
- Clients accessing the daytime service (TCP)
- DBT product initial experience
- 学校实训要做一个注册页面,要打开数据库把注册页面输入的内容存进数据库但是
- The new paradigm of AI landing is "hidden" in the next major upgrade of software infrastructure
- Day 11 script and game AI
- Solutions for project paths
- Use ideal to connect to the database. The results show some warnings. How to deal with this part
- Indefinite parameters of JS function
猜你喜欢

How to use FME to create your own functional software

Analysis of similarities and differences of various merged features (Union, merge, append, resolve) in ArcGIS

How to analyze and solve the problem of easycvr kernel port error through process startup?
![[note] Introduction to data analysis on June 7, 2022](/img/8b/9119bfdd10227f5c29ca2ece192880.png)
[note] Introduction to data analysis on June 7, 2022

(04). Net Maui actual MVVM

两个月拿到N个offer,什么难搞的面试官在我这里都不算事

关于智能视觉组上的机械臂

dbt产品初体验

el-upload上傳文件(手動上傳,自動上傳,上傳進度)

Jour 9 Gestion des scripts et des ressources
随机推荐
Error in conditional filter (if) syntax in sum function in SQL Server2005
Pig-Latin (UVA492)
关于智能视觉组上的机械臂
(04).NET MAUI实战 MVVM
Interface testing -- how to analyze an interface?
Introduction to cloud native + container concept
idea灰屏问题
JS static method
JS inheritance
第九天 脚本与资源管理
Day 10 data saving and loading
Solutions for project paths
[note] May 23, 2022 MySQL
Robot slam navigation core technology and practice Season 1: Chapter 0_ Slam development overview
[punch in - Blue Bridge Cup] day 4--------- split ('') cannot be used. There is a space after the last number of test cases. Split ()
Simple theoretical derivation of SVM (notes)
The school training needs to make a registration page. It needs to open the database and save the contents entered on the registration page into the database
Error Nova missingauthplugin: an auth plugin is required to determine endpoint URL
Interface test tool postman
Day 11 script and game AI