const myCountry = function (country, capital, language, population) {
(this.country = country),
(this.capital = capital),
(this.language = language),
(this.population = population),
(this.neighbours = []);
};
const Utopia = new myCountry("Utopia", "rabat", "arabic", "18 million", [
"algeria",
"tunisia",
]);
question from:
https://stackoverflow.com/questions/65838631/how-to-add-an-array-property-in-an-object-constructor 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…