Does something similar to Java\'s System.getProperty(\"line.separator\"); exist in JavaScript?
Edit: I am using the non-browser JavaScript environment
This did it for me (though I stumbled onto this question first).
JavaScript Platform Independent Line separator
function getLineBreakSequence() {
var div, ta, text;
div = document.createElement("div");
div.innerHTML = "";
ta = div.firstChild;
text = ta.value;
return text.indexOf("\r") >= 0 ? "\r\n" : "\n";
}
The question there is focused on Node.js use, but that answer describes the cross browser and cross platform situation well.