I have two arrays.
var addFrom = ["orange", "banana", "watermelon", "lemon", "peach"];
var addTo = ["pear", "tangerine", "grape", "orange", "blueberry"];
I would like to check if the first item in "addFrom" array is already in "addTo" array.
If the "addTo" array does not have the first item in "addFrom" array, I would like to push this item to "addTo" array.
However, if the first item in the "addFrom" array is already in the "addTo" array, I would like to move on to the second item in the "addFrom" array and do the same thing until I find the item in the "addFrom" array that is not in the "addTo" array, which will then be pushed to the "addTo" array. and I want to add only one item to the "addTo" array.
As a result, I want the "addTo" array to look like this:
var addTo = ["pear", "tangerine", "grape", "orange", "blueberry", "banana"];
How can I do this in JavaScript?