new to coding and first time poster here. i apoligze if this has been answered before, but i'm not exactly sure what i would look up to find it anyhow..
i'm going through a for loop rendering elements of an array that's pulled from an api. my goal is to only print 10 items from that array based on element of that array (i.e. not the first 10 items of the array but the first 10 items of the array that meet a criteria)
something like this:
for(let i=0;i<json.length;i++)
{
let product = json[i]
let category = product.category
renderProduct() //this is a function that prints the product to the DOM
}
in my api, each object has a category, let's say some are X, some are Y, some are Z, some are Q, etc....I want to be able to print the first 10 that are X - hoping this makes sense, and thank you all for your help and input!