How in node to split string by newline ('\n')?

How in node to split string by newline (‘\n’) ?
I have simple string like var a = "test.js\nagain.js" and I need to get ["test.js", "again.js"].
I tried

a.split("\n");
a.split("\\n");
a.split("\r\n");
a.split("\r");

but none of above doesn’t work.

48 thoughts on “How in node to split string by newline ('\n')?”

  1. Pingback: keto caramel
  2. 952469 872993Hello there! I could have sworn Ive been to this blog before but right after checking via some with the post I realized it is new to me. Anyhow, Im undoubtedly glad I identified it and Ill be bookmarking and checking back often! 587144

    Reply