0

I have object like this:

titles: {
   dr: 'Dr',
   prof: 'Prof',
   profdr: 'Prof Dr'
}

How can I transform it into array like this:

['Dr', 'Prof', 'Prof Dr']

Method should be dynamic because I need it for multiple objects with different number of properties.

Dušan
  • 269
  • 1
  • 11

1 Answers1

2

Use Object.values

const titles = {
   dr: 'Dr',
   prof: 'Prof',
   profdr: 'Prof Dr'
}
console.log(Object.values(titles));
Nitheesh
  • 19,238
  • 3
  • 22
  • 49