I don't understand what I am doing wrong. I have a simple code:
console.log(req.params.id);
let tour = tournaments.find((item) => {return item.id === req.params.id});
console.log(tournaments);
console.log(tour);
console.log(req.params.id);
Where tournaments
is an array of objects. Here is my output:
1592563085412
[
Tournament {
id: 1592563085412,
discipline: 'chess',
type: 'Bracket Tournament',
description: 'des 1',
date: '2020-06-19 12:38:05'
}
]
undefined
1592563085412
Why I am getting undefined after console.log(tour);
What should I change? I expected to receive an object where id = 1592563085412
Thanks and Best Regards!