I have this script below, which is triggered on button click:
<button>Click</button>
<script>
var test = function(){};
test.prototype = {
item:[]
};
$(document).ready(function(){
$("button").on('click',function(){
var t = new test();
t.item.push(1);
console.log(t.item);//[1],[1,1],[1,1,1]
});
})
</script>
Why is it that t.item's value always loops, instead of generating a new one with none value?