The difference between using test in Firefox and IE

Time:2021-7-27
Copy codeThe code is as follows:
<script language=”javascript” type=”text/javascript”>
function fun(){
document.write(/a/gi.test(“a”));
}
fun()
fun()
</script>

The execution result in IE is: truetrue
The execution result in Firefox is: true false
In regular / expression / GI, G means global, and I means case insensitive.
Generally, the global attribute is true, which is not good for test application. Therefore / A / GI means multiple searches
Test is a single match. The correct should be / A / I, or / A /

Firefox is standard!

Recommended Today

SQL exercise 20 – Modeling & Reporting

This blog is used to review and sort out the common topic modeling architecture, analysis oriented architecture and integration topic reports in data warehouse. I have uploaded these reports to GitHub. If you are interested, you can have a lookAddress:https://github.com/nino-laiqiu/TiTanI recorded a relatively complete development process in my hexo blog deployed on GitHub. You can […]