ES6 - Function Returning an Array


Advertisements


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 

es6_arrays.htm

Advertisements
E-Books Store