2
I want to return true
or false
if you locate Reactjs in the vector, but always returns false
, I did not want to have the answer face, but an explanation of why this giving wrong grateful since already.
var skills = [ "JavaScript", "ReactJS", "React Native"];
function temhabilidade(skills){
var resultado = skills.indexOf('ReactJS');
if(resultado == 'ReactJS'){
return true;
}else{
return false;
}
}
var mostra = temhabilidade('ReactJS');
console.log(mostra);
The return of the indexf is the index where the string was found (or -1 if not found).
– bfavaretto
Possible duplicate of Checking if value exists in an array via search field
– novic