Anonymous functions, as the name implies that there is no name, there is a good example, you can learn the following
JavaScript anonymous function, which means that a function does not have a name, the following list of test code code is as follows:/* * Commonly used functions are such */ function debug (data) { Console.log (data); } But some functions, it happens to write the code as follows: (function (x, y) { debug (x + y); }) & nbsp Above is called anonymous function. code is as follows: var fun = null; (function () { var test = function (x, y) { debug (x +y); } Fun =test; }) (); This time you enter fun in the browser's console, and you will find that it prints out function (x, y) {debug (x +y); Well, obviously, this is a A function, if you enter fun (1, 2); This is the time to print out 3. Let's look at the types below. Code as follows: var U = { uid:32812, gamelist: (function () { var list = new Array (); list[7]= ' 360; nbsp List[6]= ' Baidu '; if (list!= ' null ') { return list; } } ) (), serverlist: (function () {& nbsp var list = new Array (); list[1188]= ' 360 '; list[1165]= ' Baidu '; if (list!= ' null ') { return LIST;&NB Sp } } ) (), Channellist: (function () { var list = new Array (); list[9]= ' hand swim net '; return list; } ) (), searchname:function (t,id) { if (id = False | |/^d+$/.t EST (id) = = false) { Return ' This is a function '; }else if (eval (t). hasOwnProperty (ID) { return eval (t) [id]; } else{ return ' test '; } } }; This time, you enter u in the console; you will find that this is an array. u[' searchname ' is a function, u[' qudaolist '] returns a result.