+ 2
Can we simplify case sensitive?
in example i have this code : if (x == "one" || x == "One" || x == "ONE" || ..... ) { // statements } is there any method or function or syntax so it's not necessary to type the case sensitive one by one? Thank you, Master
5 Antworten
+ 5
var a = input.value;
var b = a.value.toLowerCase();
https://code.sololearn.com/WUteJzI5p7SZ/?ref=app
Check this old code of mine
+ 5
Wan Sorry I forgot to write them before. Now I have fixed my answer.
+ 2
toLowerCase() is a function so you should include parenthesis at the end.
+ 1
Thank you, i modified my code to :
...
var x = prompt ("say yes");
var y = x.toLowerCase();
alert(y);
....
and it's worked 👍🏻
0
it doesn't work in this my code :
...
var x = prompt ("say yes");
var y = x.toLowerCase;
alert(y);
....
result : " function toLowerCase() {[native code]} "