Scope-js Learning note 2015-6-8 (52nd Day)

Source: Internet
Author: User

1, about the return in the function:

When you use the return statement, the function stops execution and returns the specified value.

Syntax function myFunction ()
{
var x=5;
return x;
}

The above function will return a value of 5

Note: the entire JavaScript does not stop executing, just the function. JavaScript will continue to execute code from where the function is called.

2, JS about

Scope:

Domain: Range, area, space

Function: Read, write (personal understanding is to perform some action, operation, or understanding as effective)

The following paragraph means that the browser treats JS work principle, here assume that there is a "JS parser", when it encountered the "<script>" this label, it will get up to work, before the work, to do a pre-analysis: For example, to find "var" "function" To prepare for work, and then to parse the code on a row-by-line basis;

Browser:

/* "JS parser"
1) "Find something": var function parameter

A = ...
All variables, before formally running the code, assign a value in advance: Undefined, so for a variable that does not have an assignment, it returns undefined
FN1 = function fn1 () {alert (2);}
All functions, before the code is formally run, are the entire function block.

Pre-parsing of JS

Encounter duplicate name: leave only one
Variables and functions have the same name, leaving only the function

2) Read the Code by line:
Expression: = +-*/% + +--! Parameters ...//These meta operators are expressions


An expression can modify a pre-parsed value! */

Scope-js Learning note 2015-6-8 (52nd Day)

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.