我正在关注 codecademy 上有关 Javascript 对象的教程,以下代码有效,它显示输出“莎莉”年龄为 39 岁,而霍尔顿斯年龄为 16 岁”,但编辑器说“opps,再试一次,错误”。请问代码有什么问题?
function Person( name,age ) {
this.name = name;
this.age = age;
this.species = "Homo Sapiens";
}
var sally = new Person("Sally Bowles", 39);
var holden = new Person("Holden Caulfield", 16);
console.log("sally' age is " + sally.age + " while Holdens age is " + holden.age );