Back

kodekatta string 16

Created 3 years ago
608 Views
2 Comments
MohamedMusthafa0ctwIa
@MohamedMusthafa0ctwIa
MohamedMusthafa0ctwIa
@MohamedMusthafa0ctwIaProfile is locked. Login

Given a string S, print 'yes' if it has a vowel in it else print 'no'.
Sample Testcase :
INPUT
codekata
OUTPUT
yes

below is my code;

let s=userInput[0];

let sum=0

let v=["a","e","i","o","u"];

for(var i=0;i<s.length;i++)

{

for(var j=0;j<=v[j];j++)

{

if(s[i]==v[j])

{

sum=sum++;

}

}

}

if(sum===0)

{

console.log("no");

}

else

{ console.log("yes"); }

here the inner if function is executing..why?

what is the wrong in the code?

Comments (2)
Please login to comment.