您好,欢迎访问一九零五行业门户网

js中的回调函数

127d2803af93e93eb8d5f3b3a2aa0f46 
  ac3918346a7ac5f6f7654ca67941320a
<!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <base href="<%=basepath%>"/> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>回调函数</title> <script type="text/javascript" src="js/jquery-1.7.1.min.js"></script> <script type="text/javascript"> //返回值是一个函数格式 function a(callbackfunction){ console.log("这是parsent函数a"); var m=1; var n=3; return callbackfunction(m,n); } function b(m,n){ console.log("这是回调函数b"); return m+n; } $(function(){ var result=a(b); //输出结果是:4 console.log("result="+result); var c=function(){ return 3*4; }; console.log("输出的结果是:"+c()); }); </script> </head> <body> </body> </html>
其它类似信息

推荐信息