I am trying to separate these string:
var str = '(john) the quick brown (emily) fox jumps over (steam) the lazy dog.'
var str1 = '(john) the quick brown fox jumps over (steam) the lazy dog.'
so that the array will look something like this:
john: "the quick brown"
emily: "fox jumps over"
steam: "the lazy dog."
and
john: "the quick brown fox jumps over"
steam: "the lazy dog."
So far I have tried to use the split() and join() functions, but to no avail.
var strNew = str.split(' ').join('|');
var johnSplit = strNew.split('(john)');
str = johnSplit;
var emilySplit = str1.split('(emily)');
console.log(johnSplit);
console.log(emilySplit);
johnshould be a name of variable of array or what?