javascript當中函式指標用法
阿新 • • 發佈:2021-11-10
javascript當中函式指標用法
12)函式指標
例 3.12.1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<script type="text/javascript">
function sortNumber(a, b)
{undefined
document.writeln(a + b);
}
function sortq(sortNumberqqq)
{undefined
document.writeln("馬克-to-win");
sortNumberqqq(1, 2);
return 6;
}
/* note that it will report error if we write the following statement as document.write("test "+sortq(sortNumberqixy));
note that here sortNumber is a function pointer.
下面這句話是先執行sortq(sortNumber),等返回值以後,再執行document.write("test "*/
document.write("test " + sortq(sortNumber));
更多內容請見原文,文章轉載自: https://blog.csdn.net/qq_44594249/article/details/100144334