How to remove a question mark from a string?

I wanted to remove a "?" at the end of string.

Since a question mark is a quatifier for the regExp, It need to be treated as a character.

Here's how I have done it.


const stringWithQuestionMark = "I am a string with question mark at the end ?";

stringWithQuestionMark.replace(/\?/g,'');