New course! Every coder should learn Generative AI!
Try a free lesson0
Help me please
why this code output only 1 symbol? https://code.sololearn.com/WhB3VRC4WiQk/?ref=app
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.
+ 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.
0
your code output nothing(
0
but how to make so that you could enter any number of symbols?