When given a string such as
address = "12345 White House Lane"
Is there any way to identify whether the first character of the string ("1" in the example above) is a number or a character? In my case I need to be able to identify if its a number, and if so, shave off the number part of the address (leaving only the street name).
I have tried using the isNaN function
if(isNaN(address[0]){
//Do this or that
}
but I am told that it is not reliable enough for broad using. Was also told that I could use a regex function similar to
if(address.matches("[0-9].*")){
//Do this or that
}
But that only seems to throw type errors that I dont fully understand.
/^\d/.test(word)word.match(/[0-9].*/)<- there is nomatches, and you want a regex literal, not a stringwordderived fromaddress?