Coding⏱️ 2 min read📅 2026-05-31

How to Fix: .includes() not working in Internet Explorer

The .includes() method is not supported in Internet Explorer. Use the String.indexOf() method instead.

Quick Answer: Use String.indexOf() to achieve the same result.

Internet Explorer does not support the `includes()` method. This is because Internet Explorer uses a different implementation of the String API, which does not include this method.

🔍 Why This Happens

  • [Cause]

🛠️ Step-by-Step Verified Fixes

Method 1: Using the `indexOf()` Method

  1. Step 1: Check if the index of the substring is less than 0. If it is, return true.

Method 2: Using a Regular Expression

  1. Step 1: Use the `RegExp.test()` method to check if the string includes the substring.

✨ Wrapping Up

In summary, if you need to support Internet Explorer, use one of these methods to achieve the same functionality as `includes()`. Remember that these workarounds may have performance implications.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions