ES6 - Function Returning an Array
The following example better explains this concept.
Example
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.
Output
Mary Tom Jack Jill
Advertisements