explode new line in javascript

javascript, php

Solution

The answer is:

items = model.split("\n")

Problem

How do I convert the php code below into javascript? I google it and found something to do with st.replace(/,/g,"\n") but how to apply it to the variable? I have low knowledge about javascript and trying to learn it. ``` $items = explode("\n", $model); ```

Original source