Case-Insensitive IF

2022 visit: it’s fun seeing where I started, now JavaScript is my best friend.

Hello there!

I’m wondering if there’s a way to make a IF test case-insensitive?
For example:

$(eval
var a = “$(query)”;
var b = “TestABC”;
var c = 0;
if(a==b){
c = 1;
}
c;
)

and even if the $(query) variable is “TestABC” or “testabc” the response of the command to be 1.

Thanks in advance for the answer!

You could try turning strings a and b uppercase, then compare those:

$(eval a=decodeURIComponent(`$(querystring)`);a.toLowerCase()==`testabc`?1:0)
1 Like

OMG, it worked, thank you so much! :heart:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.