0

E.g. I have sample string as below:

var str = "Visit ? W3Schools ??"

I want to find the double question mark "??" exist in that string.

Anyone can help will be appreciated.

Decode
  • 160
  • 3
  • 13

1 Answers1

1

Use indexOf('??'):

var str = "Visit ? W3Schools ??";
console.log(str.indexOf('??'));

NOTE that if you use includes() it will not work in IE browser.

Ankit Agarwal
  • 30,378
  • 5
  • 37
  • 62