JavaScript standard Reference Tutorial (Alpha) Notes

Source: Internet
Author: User

JavaScript Standard Reference Tutorial (Alpha) Notes http://javascript.ruanyifeng.com/#introduction

2.1.4 N--: Use n again to execute n=n-1;--N: Execute n=n-1 before using n;

The 2.1.5 chunk ({}) var does not constitute a separate scope for the command, and does not differ from the case where chunks are not used.

2.1.6.3 If there is no break statement inside the case code block in the switch structure, it will then proceed to the next application.

It is important to note that the switch expression after the statement, compared to the expressions case following the statement, compares the running result with the strict equality operator ( === )rather than the equality operator ( == ), which means that no type conversion occurs when compared.

2.1.6.4 expression must return a value-(https://www.zhihu.com/question/39420977/answer/81250170)

The 2.1.7.4 break statement is used to jump out of a code block or loop. The continue statement is used to terminate the loop immediately, returning to the head of the loop structure and starting the next round of loops.

If there are multiple loops, break statements and continue statements without parameters are only for the inner loop .

How the break statement and the continue statement take arguments: add a number / tag after break / continue to indicate a few loops / tag loops,  Eg:break 2; /* Jump out of 2 cycles */; (http://wanlimm.com/77201406202191.html)

(a link to a statement note: https://www.jianshu.com/p/0ec3434f7781)

The 2.1.7.5 tag is equivalent to a locator, which can be any identifier, usually with break and continue.

Object literals are one of the salient features of javascript: they allow you to create objects directly-no classes are required.

    • object: An object stores data in a property. Each property has a name and a value.
      var obj = {         123,         "abc"     }     = 456;     obj[// Same as the previous statement
    • Array
          var arr = [true, "abc", 123];    Console.log (arr[//  ABC    //  3

Note: Functions and arrays are objects. For example, they can have attributes:

    function foo () {}     = 123;

Instanceof is a two-dollar operator (operator) that determines whether its left object is an instance of its right class and returns a Boolean type of data.

Data type

2.2.2 JavaScript has three ways to determine what kind of a value is.

    • typeofoperator (note null returns object)
    • instanceofOperator
    • Object.prototype.toStringMethod

The 2.2.3var statement has no return value. because var a = 1; is a declaration statement, the declaration statement does not return anything, so there is no return value. Then a = 1; is an assignment statement that returns 1.

2.2.4 If JavaScript expects a location to be a Boolean value, the existing value at that location is automatically converted to a Boolean value. The conversion rule is that except for the following six values are converted false , other values are considered true .

    • undefined
    • null
    • false
    • 0
    • NaN
    • ""or ‘‘ (empty string)

Note that the [] boolean value corresponding to the empty array () and the empty object ( {} ) is true .

JavaScript standard Reference Tutorial (Alpha) Notes

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.