I have a reference array of phrases like this:
const reference = ["your", "majesty", "they", "are", "ready"];
and I want to join some of the elements of above array based on another array so if another is this:
const another = ["your", "they are"];
The the result would be like :
result = ["your", "majesty", "they are", "ready"];
another situation to be more clear:
const reference = ["your", "majesty", "they", "are", "ready"];
const another = ["your majesty", "they are ready"];
result = ["your majesty", "they are ready"];
or:
const reference = ["your", "majesty", "they", "are", "ready"];
const another = ["majesty they", "ready"];
result = ["your", "majesty they", "are", "ready"];
and of course if there is an empty another we get the same reference as the result:
const reference = ["your", "majesty", "they", "are", "ready"];
const another = [];
result = ["your", "majesty", "they", "are", "ready"];