Unexpected result related to binding & scoping

Problem with the result
This is actually not from any challenge but I’m trying to understand all the scoping & binding.

	var printNumTwo = [];
	var i;
	for (i = 0; i < 3; i++) {
	  if (i === 2) {
	    var result = printNumTwo.push(i)
	console.log(result);	    //return 1
	console.log(i)	          //return 3

I understand that this console.log(i) would return 3 because it was referring to the updated ‘i’ declared in global scope. But I don’t understand why would the variable ‘result’ return value 1??? My head is exploding :exploding_head:

   **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36 Edg/93.0.961.47

1 Like

What does the function push return?

MDN link

Array.prototype.push() - JavaScript | MDN