let pattern1 = /Wonderdevelop/; let pattern2 = /WD/i; document.write(pattern1.ignoreCase); //false document.write(pattern2.ignoreCase); //true
- Here, we have created two variables namely pattern1, and pattern2.
- We assigned the first variable pattern1 to “/Wonderdevelop/” and pattern2 to ” /WD/i”.
- Note that pattern2 has an “i-modifier” and pattern1 doesn’t have an “i-modifier”.
- So, ignoreCase returns false for pattern1 and true for pattern2.