In this tutorial, you are given a string, and learn how to split the string with new line character as delimiter.
1. In the following program, we take string value in
name variable, and split this string at new lines.
let name = 'apple\nbanana\ncherry'; let output = name.split('\n'); console.log(output);