The newest and best JS merge array, move elements (strongest ^_^)

The code is very simple (otherwise it wouldn't be the strongest), I didn't intend to talk nonsense, but

// merge 
a.push(...b);
 // move example 
// move to first 
function moveToFirst(i){
a.unshift(a[i]);
a.splice(i+1,a.length,...a.slice(i+2));
}

 Not yet 150.. . . . .

Let me analyze it. You can see that the three points are the key. It converts the array into a value one by one, which was originally used for indeterminate parameters.

function(a,b,....c);

Requirement must be the last item

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325089496&siteId=291194637