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