I have a array which I want to loop through so I use the map prototype. Inside the callbackfn of each element I want to run several expressions.
const test = [{ name: "foo", value: "1" }, { name: "bar", value: "2" }, { name: "x", value: "3" }]
let found = false;
test.map(name => (
console.log(name.name),
console.log(name.value),
found = true
));
I've separated each expression with a ,
. Whilst this runs correctly and produces the correct results I can see my eslint saying Unexpected use of comma operator no-sequences
How am I meant to put multiple expressions inside the map function?
See Question&Answers more detail:os