js split on new line or break 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?" ]