DanNad
3 years agoContributor
How to remove/replace empty lines from string?
Hello all i cant get the empty lines to be removed. Example: i have a String like this: Example: Object is: page.querySelectorAll("*")[0].innerText the innerText i get is similar to this: ...
- 3 years ago
Have a look at https://www.freecodecamp.org/news/javascript-split-how-to-split-a-string-into-an-array-in-js/
You need to split your string into lines (array) and then remove empty lines (into a new array). This will give the output you require
Example,