split string with new line javascript code example
Example 1: split text by new line javascript
myText.split(/\n/)
Example 2: string split javascript newline
let string = "Hi\nHow are you?"
let newstrings = string.split("\n"); // [ "Hi", "How are you?" ]