Answers for "removeTags"

0

removeTags

<script>
function removeTags(str) {
    if ((str===null) || (str===''))
        return false;
    else
        str = str.toString();
          
    // Regular expression to identify HTML tags in 
    // the input string. Replacing the identified 
    // HTML tag with a null string.
    return str.replace( /(<([^>]+)>)/ig, '');
}
document.write(removeTags(
    '<html>Welcome to GeeksforGeeks.</html>'));;
</script>
Posted by: Guest on January-10-2022

Browse Popular Code Answers by Language