JavaScript Learning Note--arguments

Source: Internet
Author: User

   //FN (+/-)//Argument   functionFN (a,b,c) {//Formal Parametersalert.log (arguments)//Popup [Object Arguments], is a collection of arguments arguments=>[1,2]Console.log (arguments)//[A]Alert (arguments.length)//arguments and LengthsAlert (Arguments[1])//in the actual parameter 2   }   //when the number of arguments to a function cannot be determined: arguments   functionsum () {varN=0;  for(vari=0;i<arguments.length;i++) {n+=Arguments[i]}returnN; } console.log (SUM (1,2,3,4,5)); //Scope    varA=1; functionFn2 (a) {arguments[0]=3; alert (a); //3        vara=2;//In Line code parsing, this changes only the FN2 function to pre-parse the value of a in a=2, and does not change the value of a in the global pre-parseAlert (arguments[0]);//2} fn2 (a); alert (a); //1

JavaScript Learning Note--arguments

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.