The this point in JS (a few simpler):1. This point of the normal function points to the window;The 2 object method points to the current object;3. () = "Arrow function points to the object when defined;Apply and call can change the current this
ObjectiveAs JavaScript provides more syntax, there are more and more ways to re-weigh arrays. Now from the most primitive way to the most concise way, step by step to analyze.Double loopThe array de-weight, is not the comparison of array elements,
For any JavaScript-based developer, this is definitely a must-read article, and an artifact that boosts development efficiency. Body Js 1. Ternary operators Using the ternary operator is a good choice when you want to write If...else
Both apply and call exist to change the context in which a function is run (just tochange the direction of this inside the functionIf you use the Apply or call method, then this points to their first argument, and the second parameter of apply is an
In the host Dian after the system, I chose Vue-resource this plug-in as a communication tool with the server, but heard the front-end peer said Vuejs2.0 has not been in maintenance Vue-resource, vuejs2.0 has used Axios. Because I just vux this UI
1. Have you tried to sort the array elements? JavaScript is sorted by default using the dictionary order (alphanumeric). Therefore, [1,2,5,10].sort () results are [1, 2, 5] .If you want the right sort, you should do this: [1,2,5,10].sort ((A, B) +-a)
forEach()Method executes the supplied function once for each element of the array.Note: no new array is returned and no return value !Application scenario: Bind event handlers for some of the same elements!Const ARR = [' A ', ' B ', ' C
1, filter is also a common operation function, he is used for some elements of the array, and then return the remaining elements, and map () like, the array of filter () also accepts a function, and map () is different, filter () The function of the
From the perceptual point of view, I was not bothered to use Vue, think the react kit used more comfortable, but the more to fire vue now, so also not into the Vue (Chowder) pit. Vue/anguarjs/react, the three-to-one relationship is
Objective
If you want to ask which of the two knowledge points in JavaScript are confusing, scoping queries and mechanisms are definitely at the this top. So this article starts this with four binding rules in JavaScript, so let's take a look.
Data type
JavaScript is a weakly typed language, but it is not without a type, and JavaScript can recognize the following 7 different types of values:
Basic data types
1.Boolean
2.Number
3.String
4.null
5.undefined
6.Symbol
Object
1.Array
This in Javascript is a completely different mechanism from other languages and is likely to confuse some engineers who write other languages.
1. Mistakenly think this point to the function itself
According to the English grammar of this, it is
1. Simplifying the wording
When we write the react component, we refer to the official document, one to declare state, two to bind the function of this, the general writing is as follows:
Class DEMO extends React.component {
constructor () {
This is a keyword in the JavaScript language.It represents an internal object that is automatically generated when the function is run, and can only be used inside the function. Like what
function Test () {
this.x = 1;
}
The
This article comes from years of experience in JavaScript coding techniques that are suitable for all developers who are programming with JavaScript.The purpose of this article is to help you become more proficient in the use of JavaScript language
1 references1.1 Use const for all references, do not use Var.(This ensures that you cannot reassign a reference, or cause a bug or a difficulty to understand)Bad var a = 1; var B = 2;//good const A = 1; Const B = 2;1.2 If you must require a
Introduced
This is one of the most intriguing features in JavaScript, and the first step in learning this is to understand that this is not a scope to point to a function or to a function. This is actually the binding that occurs when a function is
In the strategy signal, often use the arrows to express the Open warehouse (many, empty) and other information icons. If it can be shown concretely in the picture, it is a very intuitive expression, which is beneficial to the more accurate
The example of this article for everyone to share the JavaScript implementation of the image of the use of carousel components for your reference, the specific content as follows
Effect:
Automatically loop the picture, there is a button below to
This is a simple article about some tips for using JavaScript arrays. We will use different methods to combine two JS arrays and discuss the advantages and disadvantages of each method. Let's first consider the following situation: this is a simple
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.