The function of JS

Source: Internet
Author: User

First, the definition:

1. function declaration functions func () {}

2. Function Expression var func = function () {}

Note the point:

  

var function  //  OK//  error, test isn ' t defined

The difference between an anonymous function expression and a named function expression

(1) Named function expressions

function//  test

(2) An anonymous function expression

var test  function//  func//  test

Second, return effect

1. Returns the result value of a series of functions processed by a function

2. Termination of function operation

The number of arguments passed and the number of parameters set can be more, less, not wrong

Why? Because the form context of a function (an object) has a name of the arguments property, and its value is an array of classes, which stores all the arguments passed in, so that when the function is called, the arguments are directly stored in the class array as the attribute name as the parameter name as the property names. Instead of worrying about whether the number of arguments is the same as the number of parameter sets

The number of parameters can be viewed through the funcname.length by arguments.length

Iv. Scope

1.

------------------------------

  

The function of JS

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.