1
I have a function that in thesis is to make a check if the variable x
is equal to the variable y
.
function teste(x){
if (x == 'y*') {
alert('igual')
} else {
alert('diferente')
}
}
I want you to check if it’s y
and start with y
. That’s why I put the *
, to take everything that comes after, but it doesn’t work.
Then it wouldn’t be, so,
s.indexOf("y") === 0
?– Woss
var s = "palavraY";
alert(s.indexOf("Y"));
this will have return the position he finds the Character if he does not find it returns -1.– Sr. João
Exactly, it would not be clearer if it already adapted to the needs of the question?
– Woss