# Array problem - location a specific value!?!

**URL:** <https://forum.kirupa.com/t/array-problem-location-a-specific-value/236960>\
**Category:** programming\
**Created:** [August 25, 2007, 4:52pm UTC](https://forum.kirupa.com/t/array-problem-location-a-specific-value/236960 "2007-08-25T16:52:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![booeriis](https://avatars.discourse-cdn.com/v4/letter/b/919ad9/32.png) [@booeriis](https://forum.kirupa.com/u/booeriis)\
**Post date:** [August 25, 2007, 4:52pm UTC](https://forum.kirupa.com/t/array-problem-location-a-specific-value/236960/1 "2007-08-25T16:52:40Z")

</div>

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
