Reputation: 519
I have two object now
obj1-> [ 'logo', 'FinTech startup', 'design' ]
obj2-> [ 'logo', 'tech startup', 'design' ]
What is the fastest way to turn them into
obj1-> [ 'logo', 'FinTech', 'startup', 'design' ]
obj2-> [ 'logo', 'tech', 'startup', 'design' ]
Please?
Thanks!!
Upvotes: 0
Views: 97
Reputation: 386868
You could use Array#join
and Array#split
with space.
var array1 = ['logo', 'FinTech startup', 'design'],
array2 = ['logo', 'tech startup', 'design'];
array1 = array1.join(' ').split(' ');
array2 = array2.join(' ').split(' ');
console.log(array1);
console.log(array2);
.as-console-wrapper { max-height: 100% !important; top: 0; }
Upvotes: 3