JavaScript array if one element same takes another element in array

join shbcf.ru