-1
Can I use Arrow Function in this example? If so, how would I look? What is the best way to search for value?
var msg = ["Orange", "Melancia", "Abobora"];
var fruta = "Melancia"
buscar(fruta);
function buscar(str){
if(msg.indexOf(str) > -1){
console.log(str);
}else{
console.log("Fruta não encontrada");
}
}
I couldn’t figure out what you want. Do you search the list by the index where the word "watermelon" is for "watermelon" at the end? It didn’t make sense to me.
– Woss
@Andersoncarloswoss I’m going to make sense of logic
– alxwca