You should call push() inside your click() event to make it run on every click:
$(document).ready(function(){
if(typeof arr == "undefined"){
var arr = new Array();
}
$("#submit").click(function(){
arr.push(2);
console.log(arr);
});
});
