Prototyping: Using prototype to extend objects
object.prototype.method=function;
/**
* Add equals function to String type
/
string.prototype.equals=function (str) {return
this==str.tostring ();
};
/**
* Adds the trim () function to string/
Main content:1. HTML DOM Elements2. HTML DOM Events3. HTML Dom InstanceFirst, DOM elementsMain operations include adding, deleting, and replacing HTML elements1. Create a new HTML element(1) Method one: AppendChild () appendTo add a new element to
How JavaScript saves text as a file in a browserTested the second way to save more text than to get stuckvar saveTextAsFile1 = function (text, FileName, success, error) {var data = text; if (! ( Text instanceof Array) {data = [text]; } var
JavaScript is an object-based (object-based) language, and everything you encounter is almost always an object. However, it is not a true object-oriented programming (OOP) language because it has no syntax class (class).So, what should we do if we
function as return valueHigher-order functions can also return a function as a result value, in addition to the ability to accept functions as parameters.Let's achieve a Array sum of the pairs. In general, the function of summing is defined like
1, what is the closure of the packageClosures, the official explanation for closures is that an expression (usually a function) with many variables and environments that bind these variables is also part of the expression.Features of closures:1. As
On Javascript The this point of the problem, there are many analytical articles on the network, written very well, such as here and hereI'm here to make a brief summary.This of the arrow functionsThe scope within the arrow function that this points
The Web front end has three layers:HTML: Describing the structure of a page from a semantic perspectiveCSS: From an aesthetic perspective, describe the style (beautify the page)JavaScript: Describing behavior from an interactive perspective
JavaScript if () { ... } else { ... } is used to make conditional judgments. For example, depending on the age of different content, you can use the if statement to implement the following:var age =; if // if age >= 18 is true, the IF statement
Method of String 1. String: The contents of the enclosed or double quotation marks in JS are strings;var t = "true"; Console.log (typeof T); // "string"Console.log (typeoftrue); // "Boolean" var str = "Yyy./niha"; var s = ' www '; var str =
I. Creating a NodeThis piece of code creates a new elementvar dom = document.craeteelement ("P");If you want add text, you must create a node for the textvar node = document.createTextNode ("This is new Textnode");Then you have to add this node to
Some operations of JS will change the original object, and some operations will not change the original object.The array's filter method does not change the original arrayWith filter, you can subtly remove the repeating elements of an array:‘use
Ylbtech-javascript-tool:wdtree
1. back to top
1, plug-in Description:Wdtree is a lightweight jquery plugin for creating a tree control with nested check boxe。Wdtree is a lightweight jquery plugin for creating a
IntroductionJavaScript's variable nature is loosely typed, meaning its variable is a name used to hold a particular value, and the value and data type of the variable can change in the life cycle of the script execution. This is a very interesting
/* * * JavaScript is divided into three sections: * 1. ECMAScript standard----JS basic syntax * 2. Dom:document Object Model Document objects * 3. BOM: Browser Object Model * * DOM function: Manipulate the elements of the page * DOM tree:
JS's closureThe variable scope of JS:var // define a global variable function Test () { a// } Test (); document.write ("a=" +a);var // define a global variable function Test () { var// define a local variable
JS maintains an object reference table:When an object is created, there is a a,a in the stack this object points to this address, and when a=new person () executes, the number of references is added to 1. When A=null is empty, the number of
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.