;outermost:for (var i=0; iSwitch statementThe switch statement in JavaScript is flexible and you can use it to handle multi-branch situations. ( note that after each case statement block, a break is added, unless it is intentionally done, the execution of a case statement block continues, knowing that abreak is encountered)The code is as follows:var num = 25;switch (true) {case num FunctionTipsstatement return; The return value is undefined;Understa
One,JavaScript can accomplish the following tasks as a scripting language:Manipulating browser objects, such as opening and closing windows;Manipulating the DOM tree;Asynchronous communication with the server through the XMLHttpRequest object;XML programming, the use of ActiveX control or browser built-in objects to complete the parsing of XMLDOM, XPath query and XSLT transformation work;Interact with browser plug-ins, such as ActiveX controls, Flash
Some concepts in JavaScript: Set clientX, clientY, offsetX, offsetY, screenX, and screenY clientX or obtain the x coordinates of the mouse pointer position relative to the client area of the window, the customer area does not include the control and scroll bar of the window.
ClientY sets or obtains the y coordinate of the mouse pointer position relative to the client area of the window. The client area d
Equality operators:
Equal = =: This operator converts the operands first, forces the type conversions, and then compares their equality.
null = = undefined //truenan = = Nan //False"5" = = 5 //true
Congruent = = =:
Congruent does not occur when a forced type transition occurs, and the type is compared.
"5" = = = 5 // falseNull = = undefined //false
Conditional operatorvarible = boolean_expression? T
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 sentence or two to let everyone understand, this is
ToString ()
Returns the string object of the object
ValueOf ()
Returns the string, numeric, or Boolean representation of the object, usually the same as the ToString () value
Operator
When a unary plus operator is applied to a non-numeric value, the operand converts the value like the number () transformation function.
Bitwise non-intrinsic: negative value minus 1 for operand
Logic and () oper
language than to consider a compiled or interpreted language, and what is the real need for a project to make the development process easier and faster to develop, or to improve execution efficiency. The first place to design JavaScript is to make the development process easier.Five, Dynamic language1, JavaScript is a dynamic language, single from the point of view of the code, dynamic language variables a
modifying the value of arguments changes the value of the named parameter. function Doadd (num1,num2) {arguments[1]=10;alert (ARGUMENTS[0]+NUM2);}Doadd (0,20);ECMAScript all parameters are passed values, it is not possible to pass arguments by referenceThree. ECMAScript function is not overloadedOverloading refers to defining two functions with the same name, as long as the two defined signatures (the type and number of accepted parameters) are different.ECMAScript two functions with the same
works, know how to judge it in a function, and recognize why it is useful.6. NewRecognize how it relates to object-oriented programming. Learn what happens to functions that are called through new. Understand how the inherited objects from the function prototype property are generated by using new.7. Apply, call, bindLearn how these functions work and learn how to use them. Learn what they do to this.8. Prototypes and Inheritance (Prototypes Inheritance)Understand that inheritance in
Closures have always been a mysterious and profound feeling to programmers, including JavaScript programmers, and in fact, the concept of closures is not an incomprehensible knowledge in functional programming languages. If the basic concepts such as the scope, the function for the independent object understood better, the understanding closure concept and in the actual programming practice application is q
the number of arguments passed to the function, the named argument without passing the value is automatically assigned the undefined value (all parameters in the ECMAScript pass the value, it is not possible to pass the argument by reference)24ECMAScript function is not overloaded25 Unlike other languages, ECMAScript does not define separate data types for integer and floating-point values, and Numer types can be used to represent all valuesThere is no need to specify the return value of a func
" name.length //3var string = "ABCDE"; var result =string.slice (3,4); // D var result1 =string.split (); // ["ABCDE"] var result2 =string.split ("); //[" A "," B "," C "," D "," E "]Split splits are broken down by what symbols in the string, and if separated by an empty string (""), each character in the string is "," to be split. var result3 =string.replace ("C", "F"); //"Abfde" (can be used for replacement) var result4 =string.replace ("C", ""); //"Abde" (can be used to delete) var result
parameter does not change the corresponding value in the arguments, and the length of the arguments object is determined by the number of arguments passed in, not by the number of named arguments defined by the function, if only one parameter is passed, then arguments[1] The value set will not be reflected in the named parameter.
In strict mode, assignment to arguments becomes invalid, and second, overriding arguments can result in syntax errors
By checking the type and number of in
"True+ """True"The difference between the 12:ecmascript operators is that they can be applied to many values, such as: strings, numeric values, Booleans, and even objectsvar x= ""; x + +0var x=true;x++1True+false1True+ """True"True+ "CCC""TRUECCC"true+{}"True[object Object]"{}++Vm2136:3 uncaught syntaxerror:unexpected Token}var x={};x++NaN({}) +true"[Object Object]true]13: Bitwise operator (unsigned right shift >>>, signed right shift >>, left shift var x=100;X=~x-101var x=253Undefinedvar x=25
-numeric value, the background call to the number () transformation function first converts it to a numeric value in the operation.Relational operators
If the two operands are numeric, a numeric comparison is performed;
If the two operands are all strings, the character encoding values corresponding to the two strings are compared;
If an operand is a numeric value, the background will use the number () function to convert it to a numeric value and then compare it.
If an oper
following procedure is done in the example above: first create a new string that can hold 10 characters, then populate the string with "Java" and "script", and the final step is to destroy the original string "Java" and the string "Script", because these two strings are useless.② converted to a string:toString (): except for null and undefined, other numeric types have this method, and in most cases the method does not have to pass arguments. However, when you call the ToString () method of a n
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.