Edit
To replace spaces in a string with a new line:
string.replace(/ /g, '\n');
/ /g
refers to a global replace of all spaces found.
Say your string is as follows:
var string = 'The quick brown fox jumps over the lazy dog';
You need to find the length of the string, the middle point, and the nearest space from the middle:
var length = string.length;
var middle = Math.round(length / 2);
var spaceNearMiddle = string.indexOf(' ', middle);
var string1 = string.substring(0, spaceNearMiddle);
var string2 = string.substring(spaceNearMiddle + 1, length);
The result of string1 and string2 would be "The quick brown fox" and "jumps over the lazy dog".
`? Very odd why you'd want to put presentation logic into code (these days). – Lee Kowalkowski Mar 06 '14 at 09:26