how to split string into lines js code example Example: split text by new line javascript myText.split(/\n/)