console.log(move([10, 20, 30, 40, 50 ], 0, 2));

function move(arr,pos,to)
{
    var temp = Array.from(arr);
    
    console.log(temp);
    temp[to]=arr[pos]
    
    for(var i = to-1 ; i>=pos ; i--)
    {
        temp[i]=arr[1+i];
    }
    return temp;
}

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: