JS anonymous function as function parameter detailed _javascript skill

Source: Internet
Author: User

Heartfelt sigh, JS really annoying.

Learn now, gradually understand what is: language is universal, no good, only good at not good.

Inheritance, polymorphism, even pointers, C can be achieved, C++,java, JavaScript (and Java is Lei Feng and Leifeng Pagoda, the difference between the name does not know how many people) can also be adapted to achieve.

Restudying, today again, the anonymous function as a function parameter.

The code is very short, spite.

<! DOCTYPE html>
 

anonymous function as a function parameter, why can it be performed automatically?

Does the anonymous function run itself?

Wrong!!! anonymous Function! = self-Executing anonymous function

There are only 1 truths: Anonymous functions are invoked as arguments in a function called (which takes an anonymous function as an argument).

function Test (A, b) {
  	a+=1;
  	B is an object, the function name is also an object, so B can refer to a function
  	//similar to the function name in C + +/
  	A is copied to B (result)
  	//JS Good flexible
  	B (a);
  }

The above JS anonymous function as a function of the parameters of the detailed explanation is small to share all the content of everyone, hope to give you a reference, but also hope that we support the cloud-dwelling community.

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.