偏函数的应用

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>偏函数的应用</title>
</head>
<body>
<script>
    var s = "iii";
    var t = Object.prototype.toString.call(s);
    function pian(x) {
        return function (s) {
            alert(Object.prototype.toString.call(s) == "[object "+x+"]");
        }
    }
    pian("String");
    var isString = pian("String");
    var isArray = pian("Array");
    isArray([1,2,3,4,"333"]);
//   传两次参数,第一次确定需要判断或者是需要处理哪个类型的函数;
//   第二个是真正需要处理的函数;
</script>
</body>
</html>

 

posted @ 2016-04-10 18:27  挥刀  阅读(162)  评论(0编辑  收藏  举报