Help me please | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Help me please

why this code output only 1 symbol? https://code.sololearn.com/WhB3VRC4WiQk/?ref=app

22nd Sep 2017, 3:45 PM
davidthegreat
davidthegreat - avatar
4 Answers
+ 4
your problem is in line 4 a = user.match("[a-z]"); it check if text in user is matched with a - z, so when you write "hello", it not work.
22nd Sep 2017, 4:34 PM
Amethyst Animion
Amethyst Animion - avatar
+ 3
the solution is add [a-z] as many as needed like below a = user.match(/[a-z][a-z][a-z][a-z][a-z]/); so when you write "hello", it will printed, but if you write "insert" it not work.
22nd Sep 2017, 4:50 PM
Amethyst Animion
Amethyst Animion - avatar
0
your code output nothing(
22nd Sep 2017, 4:29 PM
davidthegreat
davidthegreat - avatar
0
but how to make so that you could enter any number of symbols?
22nd Sep 2017, 4:58 PM
davidthegreat
davidthegreat - avatar