
let str = 'MongoDB, Express, React, Node' If it finds the matches, it returns an object, and null if no match is found. The String.match() method accepts a regular expression as a parameter and searches the string for a match. search ( / node / i ) != - 1 // true where i is the case insensitive modifier String.match() Method

The search value can be a string or a regular expression. The arch() method searches the position of the substring in a string and returns the position of the match. To learn more about the String.indexOf() method, read this guide.

The first parameter is the substring to search for, and the second optional parameter is the index to start the search from (the default index is 0). The indexOf() method is case-sensitive and accepts two parameters. If the string does not contain the given substring, it returns -1. The String.indexOf() method returns the index of the first occurrence of the substring. Read this article to learn more about the String.includes() method in JavaScript. includes ( 'express' ) // false (Due to case-sensitive) Note that includes() is case-sensitive and accepts an optional second parameter, an integer, which indicates the position where to start searching for. Here is an example: let str = 'MongoDB, Express, React, Node'

The String.includes() method returns true if the string contains the specified substring. It was introduced in ES6 and works in all modern browsers except Internet Explorer. The String.includes()provides the most simple and popular way to check if a string contains a substring in modern JavaScript. You can use either String.includes(), String.indexOf(), arch(), String.match(), regular expressions, or 3rd-party library like Lodash. There are multiple ways to check if a string contains a substring in JavaScript.
