09関数もデータ型である.html

1220 ワード

  • ,209関数もデータ型である.html
  • 
    
    
        
        10        
        
    
            //          ,          ,         (  )       
            //                ,       
            function sayHi(fn){
                console.log("   ");
                fn();//fn         
            }
            function youSay(){
                console.log("   ,   ");
            }
    
            //  
            sayHi(youSay);
    
    
    
    
    
    
            // function f1(x,y){
            //     console.log(x+y);
            // }
            // f1(10,20);
            //
            //
            //
            // function f2(x,y){
            //     console.log(x+y);
            // }
            // f2("  ","  ");
            //
            //
            // function f3(x){
            //     console.log(x);
            // }
            // f3(true);
    
    
    
    
    
    
            // //     ,fn   ,fn   ,
            // function f1(fn){//
            //     fn();//    ---  fn             
            // }
            //
            // function f2(){
            //     console.log(" ,     ");
            // }
            // f1(f2);
            // // f1(f2());// ,            (Uncaught TypeError: fn is not a function)
    
    
    
    
    
    
    
            // var f1=function(){
            //     console.log("  ");
            // };