I need to get values from multiple keys from an array of object.
trip = [
{sp: 'cbe', ep: 'tpr'},
{sp: 'tpr', ep: 'erd'},
{sp: 'erd', ep: 'blr'}
];
The output should be ["cbe", "tpr", "erd", "blr"]
what I tried is posted as an answer and it works but I used two maps to get the desired output. I know there should be a way better than my answer.
Here is my code on stackblitz