This article mainly introduces three types of functions commonly used in JavaScript, including anonymous functions, dynamic functions, and variable parameter functions, if you are interested, refer to the java code on the webpage that needs to be written in JavaScript, which contains some functions and describes the common function types in JavaScript.
1. Variable Functions
Script function show () {alert ("first... ");} Function show (str) {alert (" second ");} function show (a, B) {alert (" third... "); Alert (a +": "+ B);} script
Script show (); // When called, the previous show will be washed out // undefined: undefined show (111); // after the call, the previous one will be washed out. // 11: undefined show ("a", "B"); // after the call, the previous one will be washed out. //: B show (,); // script
In summary, functions in Javascript do not have heavy loads. All of them must be configured. Although a function declares several variables during definition, it can be passed in to any variable during the call. Each function contains a default array of arguments, which stores all the arguments passed in during this call.
2. Anonymous Functions