There were many different ways purposed by JavaScript developers for returning multiple values in an function. But ECMAScript 6 has come up with an easy way to do it.
Here is an code example of how to return multiple values using ES6:
{
return [1, 6, 7, 4, 8, 0]; //here we are storing variables in an array and returning the array
}
var q, w, e, r, t, y;
//Here we are using ES6's array destructuring feature to assign the returned values to variables.
//Here we are ignoring 2 and 4 array indexes
[q, w, , r, , y] = function_name();
alert(y);//y is 0
ES6 provides a array like syntax to assign multiple variables to values of array indexes. It also lets you ignore some array indexes.