I am looking at the code below and want to return the teams array in reverse order when calling the following code. Unfortunately this code cannot be changed.
return Array.from(new TeamsCollection()).join(',')
I know that I can change the constructor to the following:
constructor(){
return this.teams.reverse();
}
As you can see below I am unable to edit the constructor so there must be something else I am missing out on. After reading countless stack overflow answers and searching through online resources I am unable to figure out what to do. Any ideas? See the code below
class TeamsCollection {
get teams() {
return [
'Liverpool',
'Chelsea',
'Barca'
]
}
// The constructor cannot be changed
constructor(){
return this
}
}