//This is the code that takes the input string and makes an array out of each name in the string separated by a space.
function dinner(){
var names = [];
var start = 0;
var str = document.getElementById("input").value;
for(var i = 0; i<= str.length; i++){
if((str[i]==" ") || (i == str.length)){
names.push(str.slice(start, i));
start = i+1;//add one to avoid leading spaces
}
}
return names;
}//dinner
jane
lisa
taylor
chris
alyssa
will
jessica
jarl
Comparing the contents of 2 arrays can be done like this.
var array1 = ["a", "b", "c", "d", "j", "f"];
var array2 = ["a", "b", "c", "d", "e", "f"];
var similar= [];
var remove = true;
for(x in array1){
for(y in array2){
if(array1[x] == array2[y]){
similar.push(array1[x]);
}
}
}