Hi!
I was doing exercises and this doubt popped up. I have searched on the internet but I can find none. My conclusion is that it is not possible, but still, I have my doubts.
Can a function parameter be used in a Regexp?
For example:
function search(string, searched) {
var regexp = /searched/;
return string.regexp;
}
The string parameter should be a string given by the user. And the searched parameter is the word, or maybe a letter, that it is being searched.