Instead of writing this
req.session.personne_1_nom = req.body.personne_1_nom;
req.session.personne_2_nom = req.body.personne_2_nom;
req.session.personne_3_nom = req.body.personne_3_nom;
req.session.personne_4_nom = req.body.personne_4_nom;
I would like to use iteration to have less lines to write ;)
Something like :
for (let toto = 1; toto < 5; toto++) {
req.session.personne_+toto+_nom = req.body.personne_+toto+_nom;
}
How to add the toto variable in this line ?
Thank you for you help