I'm puzzled as to why the term "element" is coming up as undefined. Even after running debug, I couldn't pinpoint the cause of this issue. Does anyone have any insights on what might be going wrong here?
Below is the snippet of my code:
const { id } = req.params; //id = 2
const [billets] = await knex.raw('SELECT * FROM billet'); //RowDataPocket(3)
const element = billets //undefined
.find((billet) => billet.id === id);
res.send(mainHTML(`<h1 class="title"> ${element.titre} </h1> <p>${element.texte}</p>`));