With this function I bold the text between **text**
function bold_text($string) {
return preg_replace('#\*{2}(.*?)\*{2}#', '<strong>$1</strong>', $string);
}
Now I need to change it to js
function bold_text() {
return preg_replace('#\*{2}(.*?)\*{2}#', '<strong>$1</strong>', string);
}
I tried something like var string=string.bold_text() but its not working
How do I change get bold text by using js?
'#\*{2}(.*?)\*{2}#