I'm trying to combine the array elements of two array to create a new combined elements array. Here is what I'm doing.
const array1 = ['a', 'b', 'c'];
const array2 = ['d', 'e', 'f'];
var arr = [];
for(let i=0; i< array1.length;i++){
for(let j=0; j < array2.length;j++){
arr.push(array1[i]+array2[j])
}
}
Here is the result I'm getting.
["ad", "ae", "af", "bd", "be", "bf", "cd", "ce", "cf"]
But the expected result is
['ad','be','cf']
How can I achieve this? Where should I apply the break statement?