Char Method javascript -


having issues... can tell me did wrong on javascript code:

function getname() {     var the_name = window.prompt("enter first name", "");     var first_char = the_name.charat(0);      if(first_char = "s") {         document.write(the_name);     } else {         window.alert("please enter name starts uppercase s have displayed.");     } } 

then not valid syntax, , use == on string compare

function getname()  { var the_name=window.prompt("enter first name",""); var first_char = the_name.charat(0);  if(first_char== "s")  {     document.write(the_name); } else {     window.alert("please enter name starts uppercase s have displayed."); } } 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -