Before you learn JavaScript design patterns, you need to understand some of the relevant knowledge, object-oriented basics, this and other important concepts, as well as mastering some functional programming skills.JS polymorphicPolymorphic thinking:
JavaScript Object SummaryJS has built-in 17 objects, commonly used is an array object, a Date object, a regular Expression object, a String object, a global objectCommon methods in array objects:Concat (): Represents the merging of several arrays
#JavaScript数据类型# #一, raw data typeThere are altogether 5 primitive types of javascript: Undefined, Null, Boolean, number, String.*typeof operator: Determine what the original type of argument is followed byE.g.typeof true--Returns a BooleanNote:
object is the core concept of JavaScript and the most important data type. All of JavaScript's data can be treated as objects.Simply put, the so-called object, is an unordered set of data, by a number of "key-value pairs" (key-value) composition.To
Definition of the array:1,var arr=new Array (); --the array is a special object, and the return value of the TypeOf is ObjectARR[0]ARR[1]...2,var arr=new Array ("", "")--here directly to the array element if the number needs to be more than 2,
JavaScript exception capture1. Exception: An error occurred during execution, causing the program to stop running2. Exception throws: Generates an error message for an exception3. Exception Capturetry{the code block where the exception
three basic concepts: constructors, prototypes, instancesEach constructor has a prototype object (prototype), and the prototype object contains a pointer to the constructor (constructor), and the instance contains an internal pointer to the
1. Create1 var a = [1,2.1,true, ' abc ']23varnew Array () 4 5 var New Array (6)7varnew Array (1,2.1,true, ' abc ') 2. The array is an object, inheriting Array.prototype, you can create a propertyNegative and non-integer indexes are
// Global Variables function func () { // "undefined" var myname = "local"; // "Local" }func ();Code processing is divided into two phases, the first of which is the variable, function declaration, and the normal format of the parameter
Some time ago, the project has a requirement, is to add a validation before a function, hesitate there are many places need to add the same function, and after this function to execute the previous method, so it is intended to use hooks this thing
InfinityA special value that represents infinity. When the result of a numeric operation exceeds the range of numbers that JavaScript can represent.NanA special non-numeric value (not a number). 0 except 0, the operand of the number operator is a
Reference: http://2660311.blog.51cto.com/2650311/1358226/1) Type, native Type, object type (types, primitive types, objects types)Unlike when we were learning Java, we were told that Java was the language of full OOP: class is an abstraction of a
For the inheritance in JavaScript, because there is no class-like inheritance in the backend language in JS, the inheritance in JS is usually the prototype inheritance (prototype).function P (name) {this.name = Name;this.say = function ()
Single-chat mode is a very extreme pattern that guarantees that a class has only one entity in the entire application domain, which means that when you create instances of a class multiple times, they are the first ones created.In a Java or C #
The IMG element in the page, want to get its original size, with the width as an example the first thing you might think of is width, as follows
1 2 3) 4 5
Obviously, 400 is not the original width of the picture.
Max Points on a lineGiven n points on a 2D plane, find the maximum number of points that lie on the same straight line.
Ask how many points are on the line.Traverse it rudely with a double loop.Each round is constructed with a hash table to
Subsets IIGiven a collection of integers that might contain duplicates, Nums, return all possible subsets.Note:
Elements in a subset must is in non-descending order.
The solution set must not contain duplicate subsets.
For
Json and js arrays are really not as simple as you think.
Previously, because there were few front-end tasks, the understanding of json and js arrays was limited to a fixed format. This fixed thinking at the front-end development, especially when I
Js scope Chain & memory reclaim & Variable & Closure
Closure mainly involves several other features of js: Scope chain, garbage (memory) collection mechanism, function nesting, etc.
I. Scope chain: an index created when a function is defined and
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.