Given an array:
let myArr = ['Maybe he is a student', 'He is a boy', 'a boy'];
A javascript code is needed to remove all words in each element which are present in ALL of the other elements of the array and be unique so that no elements are repeated in the results., so the wanted result would be:
return ['Maybe he is student','He is boy', 'boy']; // "a" is common thus removed
Any suggestion on an efficient solution? thx
edit
My options are:
1) convert each element to an array and use some underscore magic.
2) concat 2 elements at a time and remove duplicate words.
3) loop with in a loop and pull my hair...