The idea is this..
var myArray = ['Apple juice','Banana Milkshake','Some Treat'];
function search(search_term){
if(myArray.indexOf(search_term) != -1){
return ..... //this is what i want to do.
};
// code is run as.
search("Apple");
My thought is when i call the search()
function and it finds a value, it should return the full length or the full value of the matched term
so if i do search("Apple");
it should return 'Apple Juice'
but i don't know any way to do this so can anyone help me find a way to do this?