45和
"45"保持一致:
function union_arrays (x, y) { var obj = {}; for (var i = x.length-1; i >= 0; -- i) obj[x[i]] = x[i]; for (var i = y.length-1; i >= 0; -- i) obj[y[i]] = y[i]; var res = [] for (var k in obj) { if (obj.hasOwnProperty(k)) // <-- optional res.push(obj[k]); } return res;}console.log(union_arrays([34,35,45,48,49], [44,55]));
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)