請幫我,我有錯誤「TypeError:sally is undefined」; 我不明白爲什麼。TypeError:sally is undefined
function Person(name,age) {
this.name = name;
this.age = age;
this.species = "Homo Sapiens";
};
var sally = Person("Sally Bowles", 39);
var holden = Person("Holden Bowles", 16);
console.log("sally's species is " + sally.species + " and she is " +
sally.age);
console.log("holden's species is " + holden.species + " and he is " +
holden.age);
嘗試'莎莉=新的Person( 「薩莉·鮑爾斯」,39);' 我想你錯過了 '新' 的關鍵字。 –
*我不明白爲什麼*任何JavaScript初學者教程會幫助你理解 –