how to solve the javascript case sensitive problem ? | SoloLearn: Learn to code for FREE!

0

how to solve the javascript case sensitive problem ?

Javascript case sensitive problem like if i put "I am fine" as a user then i just put "fine" in my bot it says error in the user

..

7/4/2020 5:28:21 AM

VSHADOW

13 Answers

New Answer

+8

That is unexpected behavior. Imma gonna have to do some experimentations on this. 😉 Thanks for sharing.

+7

Can confirm; I am also getting "1" as the output rather than "true". Even if I do "console.log(Boolean(1))", it still gives "1" and not "true". Edit: console.log(1==true); // 1 console.log(1===true); // 0 console.log(Boolean(1)===true) // 1

+6

Code Crasher Those output as boolean "true" values on my Android. Are you getting integer 1 as the output from iOS?

+5

var f = "I'm fine".includes('fine'); console.log(f); // true f = "fine".includes('fine'); console.log(f); // true f = "I'm not fine".includes('fine'); console.log(f); // true

+2

Before passing the text input to evaluation by the bot, first do a case change, i.e, to lower case or upper case depending on what case the bot requires. If it needs uppercase input, then let input = uInput.toUpperCase(); Or if its lower case needed then let input = uInput.toLowerCase(); Happy coding ☺ Keep coding 🙏🏾

+2

Calviղ other than debugging and logging, what is the purpose of using the console for output? It is not always available in the iPhone app and takes up 1/4 of the screen, so I am glad it is not often used. And does the Android app really output "true" in your code example, or does it output "1" like the iPhone app? I realize effectively they are the same, just different representation, but I am still curious. 😉

+2

thanks for your answer code crasher

+2

David Carroll yep. integers. That is why I asked. curious?

+2

i think regex with i flag is also an alternative for you (if you know)

+1

how about search sensitive?

+1

Ellaborate further please

+1

if user said i am a friend of yours even if i put friend at the user input it still says i dont understand...

+1

thanks to the two of you