Foreach loop with arrays
How to access through an entire array and print out every element? Let’s begin by adding in an array with the itemID and itemNames.
We can then do a for loop that will increment through the entire array and print out the item’s id and name based on the debug.log.
If we wanted to find a specific item, we can sort through with an if statement.
If we want to search the array to see if the mace exists, we can search the string element as well!