How to fill an array with data pass from another function

I pass data from one function to another. At the other function, I want to fill that data into an array like something below:

var j = new Array();

function addArray() {
	var i = 5;
function result(i) {
	this.i = i;
	var k = j.push(i);
var button = document.getElementById('button');
button.addEventListener('click', addArray, false);

I want the result to be like this:


But it is:


How could I get the result I want.
Thank you,

Note: In real life I don’t click. It updates automatically until condition met.

Array.prototype.push returns the new length, that’s why you’re getting 1,2,3… Also, I’m not sure you fully understand some basic JavaScript. No offense.

Thanks for response. I don’t fully understand basic javascript. I was just self-taught. I need the result that I want to get. All I do is experimenting until I get it.

That’s not very practical. Invest a little time in getting the basics right. You’ll waste less time in the end, and get better results in the long run. BTW, I added an answer to the previous post above.

Thanks, it works.