<div class="container card">
<p>{individualProduct.user_comments.map((eachComment) => (
<h1 className='comment'> {eachComment} </h1>
))}</p>
</div>
By doing this I am simply printing each value in the use_comments array, however, my goal is looping through ucomments_is_approved, and once for example ucomments_is_approved[3] == true then i should show user_comments[3], i have linked below a screenshot of my data base to make it easier, i am new to javascript thus i think its very simple however i was not able to figure it out, any help would be good.
i have a given array ucomments_is_approved =[true,false,false,true] and another array comments_users = ["good","bad", "verybad","recommended"], what I have to do is only show the comments_users when ucomments_is_approved is true so I should only show "good" and "recommended" in this case.
FIREBASE DATABASE PICTURE SHOWING THE UCOMMENTS_IS_APPROVED AND USER_COMMENTS
<div class="container card">
<p>{individualProduct.user_comments.map((eachComment, i) => {
ucomments_is_approved[i] ? (
<h1 className='comment'> {eachComment} </h1>
): null
})}</p>
</div>