I have tried this to assign id to objects of an array and the id is its index no. But forEach loop give me 0 for all index I don't know why but please help me complete this....
let allBloggerFeed = [{title, image, link, m_price, m_off, m_isAvail, cont}];
allBloggerFeed.forEach((item, i) => {
item.id = "product-" + i + 1;
})
allBloggerFeedis returning different Arrays not only one it's coming from API of blogger but when I tried to add ids in it like
[{id:{title, image, link, m_price, m_off, m_isAvail, cont}}
Then it's not working the forEach giving 0 for all
Please solve this.....
let allBloggerFeed = [{title, image, link, m_price, m_off, m_isAvail, cont}];this is not valid.