标签云

微信群

扫码加入我们

WeChat QR Code

Usually I would expect a String.contains() method, but there doesn't seem to be one. What is a reasonable way to check for this?


Not supporting IE is a feature though

2019年09月18日26分54秒

I don't like IE either, but if you have two functions that are largely identical, and one is better supported than the other one, I think you should pick the better supported one? So indexOf() it is...

2019年09月18日26分54秒

Is it possible to do a case insensitive search?

2019年09月18日26分54秒

string.toUpperCase().includes(substring.toUpperCase())

2019年09月18日26分54秒

EricMcWinNEr /regexpattern/i.test(str) --> i flag stands for case insensitivity

2019年09月18日26分54秒

Just do "potato".includes("to"); and run it through Babel.

2019年09月19日26分54秒