пытаюсь обратиться к объектам класса с названием Frontend, конкретнее, нужно посчитать у кого из Frontend большая зарплата используя filter()
и sort()
class Developer{
constructor(name, surname,skills,salary){
this.name=name;
this.surname=surname;
this.skills=skills;
this.salary=salary;
}
}
Developer.prototype.print = function(){
document.write(`<p>${this.name} ${this.surname}</p>`)
for (let i = 0; i < this.skills.length; i++) {
document.write(`
<ul>
<li>${this.skills[i]}</li>
</ul>
`);
}
}
class Frontend extends Developer{
}
class Backend extends Developer{
constructor(name, surname, skills,direction, salary){
super(name, surname, skills, salary)
this.direction=direction
}
}
let people = []
people.push(new Frontend('Vahan', 'Muadyan',['REACT','HTML','CSS','JS'],400000))
people.push(new Frontend('Marat', 'Ghukasyan',['REACT','HTML','CSS','JS'],500000))
people.push(new Frontend('Stas', 'Danyan',['REACT','HTML','CSS','JS'],300000))
people.push(new Frontend('Ashot', 'Muadyan',['REACT','HTML','CSS','JS'],200000))
people.push(new Frontend('Aram', 'Hakobyan',['REACT','HTML','CSS','JS'],150000))
people.push(new Backend('Aram', 'Ghazaryan',['NODE'],['NODE', 'Angular'],160000))
people.push(new Backend('Ano', 'Smith',['ANGULAR'], ['Angular', 'Laravel', 'Node'],1000000))
people.push(new Backend('Ando', 'Smith',['PHP'], ['Angular', 'RUBY', 'Node'],50000))
people.push(new Backend('Edgar', 'Grigoryan',['ANGULAR'], ['Angular', 'Laravel', 'Node'],190000))
people.push(new Backend('Vahan', 'Muadyan',['PYTHON'], ['Angular', 'DJANGO', 'Node'],450000))
console.log(people[Frontend]);и
people.map(a=>a[Frontend])` не работает.