books is an array with objects nested inside.
What I want to achieve is: (in the traditional way)
if (i.thirdParty.goodreads.rating < 4.2) {
i.highlighted = false;
}
Now I am learning short circuit, which as said it can be written as
for (const i of books) {
i.highlighted = i.thirdParty.goodreads.rating < 4.2 && false;
}
However, I worte it in another way and really do not understand why isn’t it working
for (const i of books) {
i.thirdParty.goodreads.rating < 4.2 && i.highlighted = false;
}
Can someone tell me what is the problem here, thank you