闭包传参

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
<script>
    function aa(x){
        var num  = 10;
        return function(y){
            console.log(num + x + y);
        }
    }

var cc = aa(15);
    cc(25);
    var dd = aa(10)
    dd(13);
    dd(23);

 

function a(){
        return function(str){
            console.log(str.name);
        }
    }
    var b  = a();
    //b('屌丝);
    b({name:'andy',age:50});
</script>
</body>
</html>

 

posted @ 2015-08-06 23:29  花神华安  阅读(227)  评论(0编辑  收藏  举报