Here , simply add the remaining elements to the vector v
for ( let k = i ; k < v1 . length ; k ++ ) v . push ( v1 [ k ] ) ; for ( let k = j ; k < v2 . length ; k ++ ) v . push ( v2 [ k ] ) ; return v ; }