javascript array line break

Solutions on MaxInterview for javascript array line break by the best coders in the world

showing results for - "javascript array line break"
Hugo
26 Apr 2018
1<!DOCTYPE html>
2<html>
3   <body>
4      <h2>Adding line break</h2>
5      <script>
6         var myArray = 'This is demo text 1!~This is demo text 2!~~This is demo text 3!~This is demo text 4!~~This is demo text 5!';
7         document.write("Original Array: "+myArray);
8         var brk = myArray.split('~');
9         var res = brk.join(" <br> ");
10         document.write("<br><br>"+res);
11      </script>
12      <p>Each occurence of ~ adds a line break above.</p>
13   </body>
14</html>