The method of JavaScript implementing function array

Source: Internet
Author: User

The

 js does not perform type checking, and the array can store anything. So I thought that the array can be stored in the function, the following is a detailed introduction to the next

One of the biggest differences between JS and Java is that functions are also considered data and can operate like an object in Java. And because JS does not perform type checking, the array can store anything. So I wondered if the array could hold a function.     Implement the following functions:    functions are stored in the array after the call (can not be stored according to the parameters)     Then you can use a large function to manipulate the array and call the functions.     Originally I wanted to use this method to perform a undo function (that is, each function stores itself in, and if undo eliminates the last function and executes the entire queue), it feels too cumbersome. However, function Array function is implemented: Paste the jsp    code as follows: <%@ page language= "java" contenttype= "text/html;" Charset=iso-8859-1 "  pageencoding=" iso-8859-1 "%>  <! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd" >  <html >  <head>  <meta http-equiv= "Content-type" content= "text/html; Charset=iso-8859-1 ">  <title>MothedList</title>  </head>  <body>  <input type= "button" onclick= "FF ()"/>  <script type= "text/javascript" >  list = new array;  F1 = function F1 (flage) {  alert ("F1");  if (flage)   List.push (F1); }  F2 = function F1 (flage) {   ALert ("F2");  if (flage)   List.push (F2); }  function ff () {  F1 (True);  F2 (true);  F = List.pop ();  f (false);  F = list.pop ();  f (); }  </script>  </body>  & lt;/html>   
Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.