
hi friend, can u plz send me javascript code for find the wether the first character is a vowel or not. 2) check wether the last character is same as the first character or not 3) check wehter it contains a space any where 4)replace all the "a" with "e" 5) extract the last three characters and check if it is "com" or not

<html>
<script>
function check(){
var str=document.getElementById("st").value;
var ch=str.charAt(0);
if(ch=='A'||ch=='a'||ch=='E'||ch=='e'||ch=='I'||ch=='i'||ch=='O'||ch=='o'||ch=='U'||ch=='u'){
alert("First character of string is vowel");
}
else{
alert("First character of string is not vowel");
}
var ch1=str.charAt(str.length-1);
if(ch1==ch){
alert("Last character is same as the first character");
}
else{
alert("Last character is not same as the first character");
}
var space = new RegExp("/^\s+$/");
if (space.test(str)) {
alert("String contains white space character");
}
else{
alert("String does not contain white space character");
}
var newst=str.replace("a","e");
alert("New String: "+newst);
var s=str.substr(-3);
if(s=="com"){
alert("It is com");
}
else{
alert("No");
}
}
</script>
Enter string <input type="text" id="st"><input type="button" value="check" onclick="check();">
</html>

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.