@rootMar 01.2016 — #0 denotes position 0 in the string, the at contains the number of the position of the @ in the email, the returned string will be the front of an email address.
@rootMar 01.2016 — #Why Ayse? When all you need to do is
To get the console up, press F12 key. var at =inEmail.indexOf("@"); var name = inEmail.substr(0,at);
str = "The @ is found at position ["+at+"] and returns the string : "+name; console.log("> "+str ); // alert("> "+str); ( remove the // to get the alert to work.)