JSFiddle - React, Tailwind, and code Playground

HTML

<div id="testDiv"></div>
<input type="button" onclick="callme()" value="click me">

CSS

#testDiv{
 border:2px solid black;
 min-width:50px;
 min-height:100px;    
}

JavaScript

var Arr1 = new Array(1,2,3,4,5,6,7,8,9,10);
var Arr2 = Arr1.slice(0);
callme = function(){
    var Counter = Arr2.length;
	for(var i=0;i<Counter;i++)
	{
		$('#testDiv').append(Arr2.pop());
	}		
    alert("The element in other array : "  + Arr1);
}