Function
Function
The function in JS
Create a function
Execute function
The core principle of function in JS
Formal parameters and arguments in a function
Arguments in a function
Implementing class inheritance with Object.create
Here is an example of the official website
Shape-superclass
function Shape () {
this.x = 0;
This.y = 0;
}
Shape.prototype.move = function (x, y) {
this.x = x;
This.y = y;
1. Non-numeric type conversion value
Number()When using transformations:
Undefined will be Nan.
If the string starts with 0, the browser ignores the leading 0 and does not convert according to the octal system
If the string starts at
Turn from: http://blog.sina.com.cn/s/blog_4b7b2fc501010xar.html
var defined variable should be a string, sometimes without a type conversion to compare, or less than 10 can also, if more than 10 will be wrongCases:var hour_select_begin=$ ('
There are two special values in JavaScript: undefined and null, which need to be noticed when comparing them. The undefined value is obtained when reading an unassigned variable or attempting to read an attribute that is not in an object.
What is a function throttling?
function throttling simply does not want the function to be invoked continuously for a short period of time. For example, our most common is when the window zoom, often perform some other operation functions, such as
This article summarizes its use methods and some of the use of experience, the content is not very advanced, is purely introductory content, see can. But if you have not used this kind of JavaScript engine library, then this article is still worth
When you perform + 、-、 *,/, = =,!=, and so on in JavaScript, if the value types on the left and right sides of the operator are inconsistent with the expected type, JavaScript converts the values on both sides of the operator to the desired type
This article mainly introduces the use of the this keyword in JavaScript, which is the basic knowledge in JavaScript beginners. You can refer to this keyword in JavaScript, which is the same as many other object-oriented languages, this is used to
1. Array typeEach item of the ECMAScript array can hold any type of data, and the size of the array can be dynamically adjusted;(1) Creating an arrayFirst method: Array constructor var colors=new Array ();var colors1=new Array (20);var colors2=new
first, take the parameter function Getparameterbyname (name) {var match = RegExp (' [? &] ' + name + ' = ([^&]*) ') in the URL . exec (Window.location.search); Return match && decodeuricomponent (Match[1].replace (/\+/g, '));} Second, regular
Logical operators are typically used for Boolean operations, typically used in conjunction with relational operators, with three logical operators: logical AND (and), logical or (or), logical non (not).First, logic and (and):&&var // true, both
PrefaceToday, JavaScript has become the core of Web page editing. Especially in the past few years, the Internet has witnessed the emergence of a large number of JS libraries in the areas of spa development, graphics processing, and interaction.If
1. for basic types such as string and number, there is a difference between them. 1) for comparison between different types, if the comparison is "converted to the value of the same type", check whether the "value" is equal, if the types are
Taking JavaScript as an example, this article describes how to optimize functions to make the functions clear and easy to read and more efficient and stable. The complexity of software continues to grow. Code quality is very important to ensure the
Today, JavaScript has become the core of web page editing. Especially in the past few years, the Internet has witnessed the emergence of a large number of JS libraries in SPA development, graphics processing, and interaction. If you deal with it for
The family of students collects the conversion between numbers and characters, and converts arrays into character and other function code.
1. conversion functions:
Js provides two conversion functions: parseInt () and parseFloat. The former
When discussing the primitive data types in Javascript, most people know the basic knowledge, from String, Number to Boolean. These primitive types are quite simple and behavior is common sense. However, this article will focus more on the unique
To find out the tree menu from a lot of HTML code (maybe there are multiple), let's first implement a method to find the DOM node through className: getElementsByClassName. This is a simple but practical extension of the browser's own DOM method.
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.