0

Please what would I write (if someone input his name and added number )to show error

https://code.sololearn.com/Wq21ee0CPNgX/?ref=app

28th Jul 2022, 10:59 PM
Alexander Oke
1 Odpowiedź
+ 2
Well one of solution will be to loop trought input string, to check each character and if this character is number you can show error or handle this in other way. This can help you with checking is character number: https://bobbyhadz.com/blog/javascript-check-if-character-in-string-is-number But easiest is to use regex, it allow you to test string with just few lines of code, so if you are interested in learning regex check this: https://regexlearn.com/ Here are java script methods, what allow you to use regex in your javascript code https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions My suggestion is to learn basics of regex, it is very powerfull skill to have
28th Jul 2022, 11:26 PM
PanicS
PanicS - avatar