原型对象创建方法案例 javascript 具体实现步骤

#我的代码

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
    </head>
    <body>
        <p id="111"></p>
        <p id="222"></p>
        <p id="333"></p>
        <script>
            function Clothes(aaa, bbb) {
                this.aaa = aaa;
                this.bbb = bbb;
            }
            Clothes.prototype.Clothes_fun = function() {
                return this.aaa + "是" + this.bbb
            };
            var clothes1 = new Clothes("黑色的连衣裙", "小丽穿的衣服");
            var clothes2 = new Clothes("黄色的吊带裙", "小美穿的衣服");

            document.getElementById("111").innerHTML = clothes1.Clothes_fun();
            document.getElementById("222").innerHTML = clothes2.Clothes_fun();
            Clothes.prototype = {
                Clothes_fun: function() {
                    return this.bbb + "是" + this.aaa
                }
            }
            var clothes1 = new Clothes("黑色的连衣裙", "小丽穿的衣服");
            document.getElementById("333").innerHTML = clothes1.Clothes_fun();
        </script>
    </body>
    <html>

问原型属性怎么添加

img


添加属性:Clothes.prototype.type = 'xxxxxx'
添加方法:Clothes.prototype.Clothes_fun = functio(){
  xxxxxx
}