The following example better explains this concept.
function disp() { return new Array("Mary","Tom","Jack","Jill") } var nums = disp() for(var i in nums) { console.log(nums[i]) }
The following output is displayed on successful execution of the above code.
Mary Tom Jack Jill