Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prompt toLowerCase not executing correctly

Tags:

javascript

I'm unsure why this isn't executing properly? It's so simple however I can't warp my head around it:

response = prompt(question.toLowerCase());

When I insert something into the prompt and I console.log it it seems to come back with uppercase letter that I added when I inserted the value into the prompt.

I want toLowerCase to convert any value into lowercase when submitted.

Any idea why this isn't working?

like image 893
Nicholas Maddren Avatar asked Apr 26 '26 13:04

Nicholas Maddren


1 Answers

It's because you are setting lower caption of prompt, not the entered text. You have to use:

response = prompt(question).toLowerCase();
like image 60
shjeff Avatar answered Apr 29 '26 02:04

shjeff



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!