JavaScript
1 function person(name){ 2 this.name = name; 3 this.prof = function(){ 4 console.log("name : " + this.name + "¥nage : " + this.age + "\ncolor : "+ this.color + "\nweight : " + this.weight); 5 } 6 } 7 person.prototype.color = "red"; 8 person.prototype.age = "18"; 9 10 var man = new person("Jackbow"); 11 man.weight = 50; 12 man.prof();
このman.weight = 50;
の部分をman = {
weight : 50
}
のように書きかえれないのはなぜでしょうか
意味合いは同じだと思うのですが
¥はバックスラッシュです。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2015/11/18 15:02
2015/11/18 15:08
2015/11/18 16:06
2015/11/19 05:05