JS函数05

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
    </head>
    <body>
        <script type="text/javascript">
            //回调函数的例子
            function calc(x,y){
                return x()+y();
            }
            function test1(){
                return 3;
            }
            function test2(){
                return 5;
            }
            
            //alert(calc(test1,test2));
            //alert(calc(function(){return 5;},function(){return 10;}));
            
            function say (value) {
                alert(value);
            }
            //alert(say);
            say('hi js.');
        </script>
    </body>
</html>

 

posted @ 2018-08-28 16:28  冯志国  阅读(74)  评论(0编辑  收藏  举报