When working with string values it might be necessary to add some js line breaks to the string at the end of a string, or at any point where needed in the string for that matter. In some cases these kinds of characters are added to the end of a string automatically when using something like the console log method in nodejs. When using console log a line break character is added to the end of the standard output each time it is called. If you do not want that to happen there is using the write method of the process stdout property.
When it comes to windows style line breaks you will want to start off with a carriage return follow by a new line. For posix style js line breaks forget the carriage return ans just inject a new line.
So the carriage return and new line escape notation can be used
Or the utf-16 code unit escape notation will work also.
So these kinds of solutions will work well in general, but in a nodejs environment there are some properties that are typically used. So lets look at just one more example at least when it comes to this sort of thing.
in node there is the End Of Line property of the os module. This property will hold a carriage return plus new line value for windows systems, and just a new line value for posix. In other words the value of the End Of line property will change depending on the underlaying operating system used.
If you want consistent values regardless of the operating system you might want to stick to escape notation.
Another options that comes to mind is the decode url component method.