Answers for "how to remove line breaks from string in javascript"

8

javascript remove line breaks from string

var stringWithLineBreaks = `
O boy 
I've got 
Breaks
`;
var stringWithoutLineBreaks = stringWithLineBreaks.replace(/(\r\n|\n|\r)/gm, "");//remove those line breaks
Posted by: Guest on August-05-2019
0

remove line break javascript

<script type="text/javascript">
    var get_banner_detail = `<?php echo json_encode($get_banner_detail); ?>`;

    exam = get_banner_detail.replaceAll(/(\r\n|\n|\r)/gm, '<br>');
</script>
Posted by: Guest on August-11-2021

Code answers related to "how to remove line breaks from string in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language