ES6 new features development WeChat applet (2)
Template Literals (template object)
The template string (Template String) in ES6 is a string that can embed expressions in the string text. String Literal.
They look the same as ordinary strings, except that the backtick character ` is used instead of the quotation marks ' or " of ordinary strings.
##Different from ordinary strings, template strings can be written in multiple lines.
#Extended Literals
ES6 adds two new numeric identifiers, the second letter is b Represents binary, the second letter is o to represent octal
ES6 better supports Unicode. Supports Unicode for extended strings and regular expressions
ES6 adds the u modifier to the regular expression, which means "Unicode mode" to correctly handle Unicode characters larger than \uFFFF. In other words, four-byte UTF-16 encoding will be correctly processed.
##In the above code, \uD83D\uDC2A is a four-byte UTF-16 encoding, which represents a character. "u" will be recognized as 2 characters according to ES5. After adding "u", it will be correctly recognized as one character according to ES6
ES6 regular expression. The y modifier is added, called the "sticky" modifier. The y modifier is similar to the g modifier, and it is also a global match. The difference is that the next match starts from the position where the previous match was successful. , the g modifier only requires a match in the remaining positions, and the y modifier ensures that the match must start from the first remaining position
#.
ES6 adds a sticky attribute to regular expressions, which is used to indicate whether the regular object has the y modifier set.##ES6 adds a new flags attribute to regular expressions, returning the modifiers of regular expressions
##
Enhanced Object Literals(Enhanced Object Literals)
The concise representation of new properties in ES6 allows direct writing of variables and functions as properties and properties of objects. method. This kind of writing is more concise.
In addition to property abbreviations, ES6 methods can also be abbreviated.
ES6 adds new attribute name expressions, allowing expressions to be used as objects when literals are defined. attribute name, that is, put the expression within square brackets.
##Destructuring Assignment
ES6 allows Extracting values from arrays and objects and assigning values to variables according to a certain pattern is called destructuring.
Destructuring assignment allows you to assign properties of arrays and objects to various variables using syntax similar to array or object literals. This assignment syntax is extremely concise and clearer than traditional property access methods.
Destructuring assignment of arrays can extract values from the array and assign values to variables according to the corresponding positions.
Destructuring assignment of objects.
Destructuring assignment of string, the string is converted into an array-like object.
Destructuring assignment of function parameters
##
The above is the detailed content of ES6 new features development WeChat applet (2). For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Xianyu's official WeChat mini program has quietly been launched. In the mini program, you can post private messages to communicate with buyers/sellers, view personal information and orders, search for items, etc. If you are curious about what the Xianyu WeChat mini program is called, take a look now. What is the name of the Xianyu WeChat applet? Answer: Xianyu, idle transactions, second-hand sales, valuations and recycling. 1. In the mini program, you can post idle messages, communicate with buyers/sellers via private messages, view personal information and orders, search for specified items, etc.; 2. On the mini program page, there are homepage, nearby, post idle, messages, and mine. 5 functions; 3. If you want to use it, you must activate WeChat payment before you can purchase it;

Implementing card flipping effects in WeChat mini programs In WeChat mini programs, implementing card flipping effects is a common animation effect that can improve user experience and the attractiveness of interface interactions. The following will introduce in detail how to implement the special effect of card flipping in the WeChat applet and provide relevant code examples. First, you need to define two card elements in the page layout file of the mini program, one for displaying the front content and one for displaying the back content. The specific sample code is as follows: <!--index.wxml-->&l

WeChat applet implements picture upload function With the development of mobile Internet, WeChat applet has become an indispensable part of people's lives. WeChat mini programs not only provide a wealth of application scenarios, but also support developer-defined functions, including image upload functions. This article will introduce how to implement the image upload function in the WeChat applet and provide specific code examples. 1. Preparatory work Before starting to write code, we need to download and install the WeChat developer tools and register as a WeChat developer. At the same time, you also need to understand WeChat

According to news from this site on October 31, on May 27 this year, Ant Group announced the launch of the "Chinese Character Picking Project", and recently ushered in new progress: Alipay launched the "Chinese Character Picking-Uncommon Characters" mini program to collect collections from the society Rare characters supplement the rare character library and provide different input experiences for rare characters to help improve the rare character input method in Alipay. Currently, users can enter the "Uncommon Characters" applet by searching for keywords such as "Chinese character pick-up" and "rare characters". In the mini program, users can submit pictures of rare characters that have not been recognized and entered by the system. After confirmation, Alipay engineers will make additional entries into the font library. This website noticed that users can also experience the latest word-splitting input method in the mini program. This input method is designed for rare words with unclear pronunciation. User dismantling

To implement the drop-down menu effect in WeChat Mini Programs, specific code examples are required. With the popularity of mobile Internet, WeChat Mini Programs have become an important part of Internet development, and more and more people have begun to pay attention to and use WeChat Mini Programs. The development of WeChat mini programs is simpler and faster than traditional APP development, but it also requires mastering certain development skills. In the development of WeChat mini programs, drop-down menus are a common UI component, achieving a better user experience. This article will introduce in detail how to implement the drop-down menu effect in the WeChat applet and provide practical

Implementing picture filter effects in WeChat mini programs With the popularity of social media applications, people are increasingly fond of applying filter effects to photos to enhance the artistic effect and attractiveness of the photos. Picture filter effects can also be implemented in WeChat mini programs, providing users with more interesting and creative photo editing functions. This article will introduce how to implement image filter effects in WeChat mini programs and provide specific code examples. First, we need to use the canvas component in the WeChat applet to load and edit images. The canvas component can be used on the page

Use the WeChat applet to achieve the carousel switching effect. The WeChat applet is a lightweight application that is simple and efficient to develop and use. In WeChat mini programs, it is a common requirement to achieve carousel switching effects. This article will introduce how to use the WeChat applet to achieve the carousel switching effect, and give specific code examples. First, add a carousel component to the page file of the WeChat applet. For example, you can use the <swiper> tag to achieve the switching effect of the carousel. In this component, you can pass b

The official WeChat mini program of Xianyu has been quietly launched. It provides users with a convenient platform that allows you to easily publish and trade idle items. In the mini program, you can communicate with buyers or sellers via private messages, view personal information and orders, and search for the items you want. So what exactly is Xianyu called in the WeChat mini program? This tutorial guide will introduce it to you in detail. Users who want to know, please follow this article and continue reading! What is the name of the Xianyu WeChat applet? Answer: Xianyu, idle transactions, second-hand sales, valuations and recycling. 1. In the mini program, you can post idle messages, communicate with buyers/sellers via private messages, view personal information and orders, search for specified items, etc.; 2. On the mini program page, there are homepage, nearby, post idle, messages, and mine. 5 functions; 3.
