I have a string as bellow
var str = " Hello";
I can get the first character of the string as
var the_char=str.charAt(0);
alert(the_char)
if(the_char === " "){
alert("first char of the query is space");
return;
}
But the alert is not poping up.I want to pop up the alert if the first character of the string is a space.How can I do this?
Thanks