javascript - Remove Matching Objects from Array While Adding them to Another Array -
i trying build 3-tiered function: first, array lists available workshops (array called 'workshops'). second, array lists workshops user has selected (this array called 'selectedworkshops'). third, have final array called 'registeredworkshops'. when function run, want objects within 'selectedworkshops' added 'registeredworkshops', want delete objects within 'selectedworkshops' both 'selectedworkshops' , matching elements 'workshops'. so, objects used exist in both 'selectedworkshops' , 'workshops', exist in 'registeredworkshops'. here's i've got far: addremoveworkshops = function(){ var numberofworkshops = selectedworkshops.length; for(var = 0; < numberofworkshops; i++ ){ registeredworkshops.push(selectedworkshops[i]); for(var j = 0, arraylength = workshops.length; j < arraylength; j++) { var searchterm = selectedworkshops[i].workshopid; ...