How can I compare one item in array to it's next or previous item using index numbers Take the code below as example
const arr = [
{
name: "A",
marks: 20,
},
{
name: "B",
marks: 25,
},
{
name: "C",
marks: 30,
},
];
So how can I compare B with A or C in an if statement using index numbers to get something done?
Aucun commentaire:
Enregistrer un commentaire