hi I’m owrking on a little inventory for my game and i was wonder how you would reffer to a specific value within the array.
i know you can refer to it’s place in the array eg. [0], [1], [2]. and remove or replace them that way. but i need to test if the array contains a string value.
eg. food = [“burger”, “fries”, “shake”] . how would i do an if statement to test if the array food. contained “fries”, regarless of it’s position in the array. and also how to remove a specific string value. i know you add it by saying
food.push(“fries”); (or something to that effect).
i’ve looked around but i can’t find the commands.
i need something like
if(food.contains(“fries”)){
food.remove.“fries”;
}
i know that’s not how its written but that’s the kind of thing i need. anyone know how to do that?
thanks
booeriis