js的继承

<!DOCTYPE html>
<html>
<head>
    <title>js继承</title>
    <meta charset="utf-8">
</head>
<body>
    <p></p>
</body>
<script type="text/javascript">
    function Person(hairs,face, eye) {
        var o = new Object();
        o.hairs = hairs;
        o.face = face;
        o.eye = eye;
        o.say = function(){
            console.log("say someting to me!");
        };
        return o;
    };
    //我们通过 Person(0,1,2)就可以创建一个包含特定信息的Person对象, 以后要生成对象直接执行Person然后给他传参数就好了;
    //比如我们要生成10个Person, 很方便很快;
    var c = 10;
    while( c-- ) {
        console.log(Person(c,c,c))
    };
</script>
</html>
原文地址:https://www.cnblogs.com/fanting/p/9981822.html