search
HomeWeChat AppletMini Program DevelopmentES6 new features development WeChat applet (5)
ES6 new features development WeChat applet (5)Mar 25, 2017 pm 05:29 PM
WeChat appletWeChat development

ES6 adds many new APIs to native objects such as Object, Array, String, Number, and Math.

Object object

Object.prototype.proto: The object has the attribute proto, which can be called an implicit prototype. An object's implicit prototype points to the prototype of the constructor that constructs the object, which also ensures that the instance can access the properties and methods defined in the constructor prototype.

Object.assign(target, ...sources): You can copy any number of the source object's own enumerable properties to the target object, and then return the target object.

Object.is(value1, value2) is used to determine whether two values ​​are the same value.

Object.setPrototypeOf(obj, prototype) sets the prototype of a specified object to another object or null (that is, the [[Prototype]] internal property of the object).

ES6 new features development WeChat applet (5)

Array object

Array.from(arrayLike[ , mapFn[, thisArg]]): Can convert an array-like object or traversable object into a real array.

Array.of(element0[, element1[, …[, elementN]]]): Put its multiple parameters of any type into an array and return it.

Array.prototype.copyWidthin(target[, start[, end]]): Shallow copy some elements of the array to different positions in the same array without changing the size of the array, return the array.

Array.prototype.entries(): Returns an Array Iterator object that contains key-value pairs for each index in the array.

Array.prototype.fill(value[, start = 0[, end = this.length]]): You can replace the values ​​of all elements in the specified range in an array. into or filled into a fixed value.

Array.prototype.find(callback[, thisArg]): If an element in the array meets the test condition, the find() method will return the first value of that element. If there is no element that meets the condition, undefined is returned.

Array.prototype.findIndex(callback[, thisArg]): Used to find the index of a specified element in the array. If the specified element cannot be found, -1 is returned.

Array.prototype.keys(): Returns an iterator of array indexes.

Array.prototype.values(): Returns a new Array Iterator object that contains the value for each index of the array.

Array.prototype: iterator method of array, by default returns the same value as values().

ES6 new features development WeChat applet (5)

String object

String.fromCodePoint(num1[ , …[, numN]]): Returns a string created using the specified sequence of code points.

String.raw(callSite, ...substitutions): It is a label function for template strings. Its function is similar to the string prefix r in Python and the string prefix in C#. @ is used to obtain the original literal value of a template string.

String.prototype.codePointAt(pos): Returns a non-negative integer with a Unicode code point value.

String.prototype.endsWith(searchString [, position]): used to determine whether the current string "ends" with another given substring, based on the judgment result Returns true or false.

String.prototype.includes(searchString[, position]): Used to determine whether a string is included in another string. If included, return true; otherwise, return false.

String.prototype.repeat(count): Construct and return a new string that repeats the current string a certain number of times.

String.prototype.startsWith(searchString [, position]): Used to determine whether the current string "starts" with another given substring, based on the judgment result Returns true or false.

String.prototype: Returns a new Iterator object, which traverses the code points of the string and returns the string value of each code point.

ES6 new features development WeChat applet (5)

Number object

Number.EPSILON: represents 1 and the minimum value greater than 1 (can be expressed as a Number).

Number.isFinite(value): Used to detect whether the incoming parameter is a finite number.

Number.isInteger(value): Used to determine whether the given parameter is an integer.

Number.isNaN(value): Used to detect whether the incoming value is NaN. This method is more reliable than the traditional global function isNaN().

Number.isSafeInteger(testValue): Used to determine whether the parameter value passed in is a "safe integer".

ES6 new features development WeChat applet (5)

Math object

Math.acosh(x) : Returns the inverse hyperbolic cosine of a number

Math.asinh(x): Returns the inverse hyperbolic sine of the given number

Math.atanh(x): Returns a numeric inverse hyperbolic tangent value

Math.cbrt(x): Returns the cube root of any number

Math.cosh(x): The hyperbolic cosine function that returns a numerical value

Math.sign(x): Used to determine the sign of a number, whether it is a positive number, a negative number, or zero

Math.sinh(x): Returns the hyperbolic sine of a number (unit is angle)

Math.tanh(x) : Returns the hyperbolic tangent function value of a number

Math.trunc(value): Removes the decimal part of the number, leaving only the integer part

ES6 new features development WeChat applet (5)

WeChat applet currently does not support API

Array.prototype.values()

The above is the detailed content of ES6 new features development WeChat applet (5). For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
微信小程序架构原理基础详解微信小程序架构原理基础详解Oct 11, 2022 pm 02:13 PM

本篇文章给大家带来了关于微信小程序的相关问题,其中主要介绍了关于基础架构原理的相关内容,其中包括了宿主环境、执行环境、小程序整体架构、运行机制、更新机制、数据通信机制等等内容,下面一起来看一下,希望对大家有帮助。

微信小程序云服务配置详解微信小程序云服务配置详解May 27, 2022 am 11:53 AM

本篇文章给大家带来了关于微信小程序的相关知识,其中主要介绍了关于云服务的配置详解,包括了创建使用云开发项目、搭建云环境、测试云服务等等内容,下面一起来看一下,希望对大家有帮助。

微信小程序常用API(总结分享)微信小程序常用API(总结分享)Dec 01, 2022 pm 04:08 PM

本篇文章给大家带来了关于微信小程序的相关知识,其中主要总结了一些常用的API,下面一起来看一下,希望对大家有帮助。

浅析微信小程序中自定义组件的方法浅析微信小程序中自定义组件的方法Mar 25, 2022 am 11:33 AM

微信小程序中怎么自定义组件?下面本篇文章给大家介绍一下微信小程序中自定义组件的方法,希望对大家有所帮助!

微信小程序实战项目之富文本编辑器实现微信小程序实战项目之富文本编辑器实现Oct 08, 2022 pm 05:51 PM

本篇文章给大家带来了关于微信小程序的相关知识,其中主要介绍了关于富文本编辑器的实战示例,包括了创建发布页面、实现基本布局、实现编辑区操作栏的功能等内容,下面一起来看一下,希望对大家有帮助。

西安坐地铁用什么小程序西安坐地铁用什么小程序Nov 17, 2022 am 11:37 AM

西安坐地铁用的小程序为“乘车码”。使用方法:1、打开手机微信客户端,点击“发现”中的“小程序”;2、在搜索栏中输入“乘车码”进行搜索;3、直接定位城市西安,或者搜索西安,点击“西安地铁乘车码”选项的“去乘车”按钮;4、根据腾讯官方提示进行授权,开通“乘车码”业务即可利用该小程序提供的二维码来支付乘车了。

微信小程序开发工具介绍微信小程序开发工具介绍Oct 08, 2022 pm 04:47 PM

本篇文章给大家带来了关于微信小程序的相关问题,其中主要介绍了关于开发工具介绍的相关内容,包括了下载开发工具以及编辑器总结等内容,下面一起来看一下,希望对大家有帮助。

简单介绍:实现小程序授权登录功能简单介绍:实现小程序授权登录功能Nov 07, 2022 pm 05:32 PM

本篇文章给大家带来了关于微信小程序的相关知识,其中主要介绍了怎么实现小程序授权登录功能的相关内容,下面一起来看一下,希望对大家有帮助。

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools