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

posted @ 2021-11-10 10:18  malala  阅读(131)  评论(0)    收藏  举报