Just starting out with coding and posting for the first time here. I apologize if this question has already been answered, but I'm not sure what exactly to search for anyway...
I'm working on a for loop to render elements from an array pulled from an API. My aim is to display only 10 items based on a specific criteria rather than just the first 10 items in the array.
Here's an example:
for(let i=0;i<json.length;i++)
{
let product = json[i];
let category = product.category;
renderProduct(); //this function 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... My goal is to display the first 10 objects that have the category X. I hope this explanation makes sense. Thank you all for your help and input!