example:// Single line commentA block-level annotation starts with a slash and an asterisk (/*). It ends with an asterisk and a slash (*/), for example:/** This is a multiline* (Block-level) annotation*/
IV. statements
The statement in ECMAScript ends with a semicolon. if the semicolon is omitted, it is determined by the parser that the statement ends, for example:
Var sum = a + B // a valid statement even if there is no semicolon ------- not recommended
Var diff = a-B; // valid statement -
Concepts and Applications of Regular Expressions in JavaScript,
Today I will share with you some knowledge about regular expressions and Their Applications in javascript. Regular Expressions are simple but not simple. For example, when my teacher gave us a lecture about this thing, I became proficient in 20 or 30 minutes, once you have no entry, you cannot make u
undefined, the loop body is not executedfor (Var propname in Window) {document.write (propname);}Label statement: Add tags to your code for future use of label:statement Strat:for (var i=0;i) {alert (i);}Label generally with break/continue, break: Jump out of the current loop, execute the loop behind the statement, if nested, jump out of the outer loop. Continue: Jump out of the current loop, go back to the top of the loop and continue the loop, if nested, perform the outer loop.17
, finally, return, void, continue, for, switch, while, Debugger* (New in fifth edition) function, this, with,default, if, throw,Delete, in, tryVI. reserved words: abstract, enum, int, short,Boolean, export, Nterface, static,byte, extends, long, Supe,Char, final, native, synchronized,class, float, package, throws,const, goto, Private, transient,debugger, implements, protected, volatiledouble, import, public, let, yield (fifth edition added)Keywords and reserved words do not as identifiers, the be
Before talking about the above concepts, we should first talk about the implicit parameter of the function in javascript: arguments
Arguments
This object represents the function being executed and the parameters of the function that calls it.
[Function.] arguments [N]Parameter Function: option. Name of the function object currently being executed. N: option. The index of the parameter value starting
, either a variable or an expression.NOTE: The switch statement uses the same character when comparing, so the type conversion does not occur.Five, functionGrammar:function Funname () { //dosth}Attention:1. The function must be called with parentheses2. You do not have to specify a return value, but you can also specify3.return statement with no return value, the function returns undefined after a stop4. Function parameters can be any number, call the function can pass any number of arguments
This article summarizes the basic concepts of the ECMAScript (hereinafter referred to as ES) language core in the third chapter of JavaScript Advanced Programming (third edition).ES recommended identifiers are camel- named.ES Fifth Edition introduced strict mode, strict mode needs to be at the top of the JS file or the first line inside the function to add "use Strict" This compilation instructions to open.
);
}
document.write(obj.fn(3,4))
/*
输出:
7
*/
It's also possible to write.
var sum=function (A, b) {
return number (a) +number (b);
}
var obj.fn=sum;
document.write (Obj.fn (3,4));
/*
Output:
7
*/
10, class and instance (1), JavaScript is the concept of no class, the class is only used to call the implementation of the class function, the function object used to call the constructor.Ref
Beauty would fade but Love would stay.
ECMA-262 describes all the basic concepts of JavaScript through ECMAScript. Before we get to the basics of how JavaScript works, let's review the history of ECMAScript: 1) What does JavaScript have to do with ECMAScript? JavaScript
: Encapsulates HTML documents into objects, becoming the world's standard in October 1998. The browsers supported by DOM1 include ie6+, Firefox, Safari, Chrome, and opera1.7+.DOM2: Added new features on DOM1, such as resolving namespacesDOM3: Encapsulates an XML document as an objectAll DOM objects in Ps:ie are implemented in the form of COM objects, which means that the DOM in IE may differ somewhat from other browsers.ii. DHTML: Dynamic HTMLis not a language, it is a short term for a number of
A function is a special object;Object: A collection of properties (name-value pairs);The function is used to initialize (with the new operator) a newly created object is called a constructor.The object is called as a method when the property is a function.Within a function body, a local variable takes precedence over a global variable of the same name.code example:varscope = "global"; // Declare a global variablefunctionCheckscope () {varScope = "local";//life a local variable with the same nam
that the value of the object is not null or undefined before using the for-in loop.Label Statement: use the label statement to add tags to your code for future Use.Break and continue with the C language, controlling code execution in the loop body.With statement, The main purpose is to simplify the work of writing the same object multiple Times. (with statement not allowed in strict mode)With (expression) statementvar qs=location.search.substring (1);var hostname=location.hostname;var url=locat
define the scope of the variable.For example, you define a variable at the beginning of a JS file (and outside the function): var first = 1; then this variable first is the local variable of the entire JS document, and the variable is automatically destroyed when the entire document is executed;Again such as:function f () {var first = 1;}Then this variable first is a local variable in the scope of the function f (), and when the function f () is executed, the variable is automatically destroyed
JS Case-sensitive Label selectors are case-insensitive in HTML/CSS ID class selector is case sensitivewhere property Name Property Name property value is not case sensitive the case-insensitive content part of the inline event onclick, etc.More than one of the same inline events will be flushed out of the backidentifiers (variables, functions, names of properties)Naming method: The first character must be a letter , an underscore , or a Comment Method Single-line comment//Paragraph comment/*
One, JavaScript composition1. A finished javascript is composed of three parts: ECMAScript, DOM, and BOM.ECMAScript: Provides core language functions-grammar, type, statement, keyword, reserved word, operator, object;DOM: Document Object Model-provides methods and interfaces for accessing and manipulating Web page content;BOM: Browser Object Model--provides methods and interfaces for interacting with the br
executeThe return statement can also have no return value, in which case the function returns a undefined value after it has stopped executing. This usage is generally used in cases where the function execution needs to be stopped prematurely without the return value.Arguments object access parameters, Arguments[0]function Doadd (num1,num2) {argument[1]=10;alert (ARGUMENT[0]+NUM2);}ARGUMENT[1] is synchronized with num2, but if the value is passed to a parameter, the value set for argument[1] is
This article is suitable for beginners of JavaScript.
Gossip first. In China, there is such a phenomenon: No matter what word or concept, there will always be some people who interpret these things as if they do not understand what they think they are very powerful. In fact, I don't know how many 2. I personally advocate conciseness and clarity. What are the words and concepts? If you can use a short sente
JavaScript code is run in the browser and is written in the tab.JavaScript code can be placed in: 1, head part, 2, body part, 3, external script, encapsulated in the. js file, do not need to write tag.JS syntax Features: 1, Case sensitive, 2, weakly typed language, 3, end with a semicolon, 4, string recommended single quotation marks.Data type: 1, Boolean Boolean type, 2, number digit, 3, string string, 4, undefined undefined, 5, NULL null object, 6
I. Classes and objects1, JavaScript objects fall into three categories: local objects, built-in objects, and host objects.There are 15 types of local objects: Object Function Array String number Boolean Date RegExp Error evalerror rangeerrorRrefenceerror SyntaxError TypeError UirerrorThere are 2 types of built-in objects: Global MathThe host object has N: All DOM and BOM objects2, how to define a class and an object in JavaScriptMethod One: Original m
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.