JSFiddle - React, Tailwind, and code Playground
JavaScript
function World() {
this.mankind = new Mankind(this);
getName = function(id) {
return this.mankind.people[id].name;
}
alert('Здесь проживают: ' + this.mankind.city.map(getName));
}
function Mankind(world) {
this.people = new Array();
this.people[0] = new Man(this, 'Vasily');
this.people[1] = new Man(this, 'Alessandra');
this.city = [0, 1];
}
function Man(mankind, name) {
this.name = name;
}
new World();