I do not know what is wrong with my code, I have revised it multiple times and changed it, can someone please tell me what’s wrong with it and how this type of code works? Here’s the code:
var sally =
var holden =
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);
var sally = new Person(“Sally Bowles”, 39);
var holden = new Person(“Holden Caulfield”, 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);
Therefore, no need to rewrite the object again by using function …etc
just directly after the var sally = new Person ()
function Person(name,age) {
this.name = name;
this.age = age;
this.species = "■■■■ Sapiens";
}
var sally = new Person("Sally Bowles", 39);
var holden = new Person ("Holden Caulfield", 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 );
//Creating an object with Person constructor it is like using the older objects with new word modifications