Here is a shorter way of achieving it:

let result = objArray.map(a => a.foo);

OR

let result = objArray.map(({ foo }) => foo)

You can also check Array.prototype.map().

Answer from Jalasem on Stack Overflow
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Array › values
Array.prototype.values() - JavaScript - MDN Web Docs
June 19, 2026 - The values() method of Array instances returns a new array iterator object that iterates the value of each item in the array.
Discussions

How to get value at a specific index of array In JavaScript? - Stack Overflow
How can I get the value at the 1st index of my array in JavaScript? More on stackoverflow.com
🌐 stackoverflow.com
Read array values in a loop in JavaScript - Stack Overflow
You got the point, showing 3 values from the array and if we are at the end of array, read from the beginning... I have an app that has remote control and has down and up keys. When the user presses the down button to get these values from an array as described in the above example, if the ... More on stackoverflow.com
🌐 stackoverflow.com
Getting Values from array - Javascript - Stack Overflow
Right now I am able to get all the values comma separated but when I split values, nothing shows up. ... So basically i want to get the unique no. from array and the no. More on stackoverflow.com
🌐 stackoverflow.com
javascript - Get values from an array of objects - Stack Overflow
0 Javascript Array of objects - how do i loop through and get the object values More on stackoverflow.com
🌐 stackoverflow.com
🌐
GeeksforGeeks
geeksforgeeks.org › javascript-array-values-method
JavaScript Array values() Method | GeeksforGeeks
December 4, 2024 - The values() method is called on the array A. An iterator object iterator is obtained from the array.
🌐
Programiz
programiz.com › javascript › library › array › values
JavaScript Array values() (with Examples)
In this tutorial, you will learn about the JavaScript Array value() method with the help of examples.The values() method returns a new Array Iterator object that contains the values for each index in the array.
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › how-to-get-values-from-specific-objects-an-array-in-javascript
How to get Values from Specific Objects an Array in JavaScript ? - GeeksforGeeks
August 5, 2025 - The filter() method is an array method that allows you to iterate over each element in an array and return a new array with only the elements that meet some condition. You can use filter() to create a new array of objects that meet some condition ...
Find elsewhere
🌐
Vultr Docs
docs.vultr.com › javascript › standard-library › Array › values
JavaScript Array values() - Get Array Values | Vultr Docs
November 29, 2024 - In JavaScript, arrays are fundamental structures used to store collections of data. One of the methods provided to interact with arrays is values(), which returns a new Array Iterator object that contains the values for each index in the array.
🌐
W3Schools
w3schools.com › jsref › jsref_values.asp
JavaScript Array values() Method
The values() method returns an Iterator object with the values of an array.
Top answer
1 of 8
9

If you are OK with manipulating your original array as you loop through it you could splice and concat similar to below (or you could use a clone of the array if you need to persist the original array):

var myStringArray = ["1","2","3","4","5","6","7","8","9","10"];

var loopByX = function(x){
  var y = myStringArray.splice(0,x);
  myStringArray = myStringArray.concat(y);
  
  return y;
}

console.log(loopByX(3));
console.log(loopByX(3));
console.log(loopByX(3));
console.log(loopByX(3));
console.log(loopByX(3));

If you want to go bi-directional (is that what you call it?), as mentioned in the comments, you could do it as below which then gives you the ability to go backwards or forward and the flexibility to do so in an arbitrary number:

var myStringArray = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"];

var loopByX = function(x) {
  var len = myStringArray.length;

  // Ensure x is always valid but you can add any behaviour here in that case yourself. As an example I return an empty array.
  if (Math.abs(x) > len) {
    return [];
  }

  var y = x > 0 ? myStringArray.splice(0, x) : myStringArray.splice(len + x, len);

  myStringArray = x > 0 ? myStringArray.concat(y) : y.concat(myStringArray);

  return y;
}

console.log(loopByX(20)); // invalid number
console.log(loopByX(-20)); // invalid number
console.log(loopByX(-3));
console.log(loopByX(-6));
console.log(loopByX(3));
console.log(loopByX(4));

2 of 8
4

You could take a function which slices three elements and if not possible, it takes the needed first values of the array as well.

function take3() {
    var temp = array.slice(index, index += 3)
    index %= array.length;
    console.log(temp.concat(temp.length < 3 ? array.slice(0, index) : []).join(' '));
}

var array = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"],
    index = 0;
<button onclick="take3()">take 3</button>

With a mapping of a dynamic count.

function take(length) {
    console.log(Array.from({ length }, _ => array[++index, index %= array.length]));
}

var array = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"],
    index = -1;
<button onclick="take(3)">take 3</button>

🌐
C# Corner
c-sharpcorner.com › blogs › get-values-from-array-in-javascript-using-jquery1
Get Values from Array in JavaScript using jQuery
June 30, 2014 - This blog defines how to get values from client side using Jquery $.each() function.
🌐
GeeksforGeeks
geeksforgeeks.org › javascript-array-values
JavaScript | array.values() - GeeksforGeeks
November 25, 2022 - Let’s see JavaScript program on array.values() function: ... Application: This array.values() function in JavaScript is used to print the elements of the given array. Let’s see JavaScript program on array.values() function: ... JavaScript ...
🌐
Stack Overflow
stackoverflow.com › questions › 44037510 › getting-values-from-array-javascript
Getting Values from array - Javascript - Stack Overflow
You can create an empty object to track the number of repetitions & an array to hold only unique values.Use indexOf to find if element already exist in uniqArray.
🌐
Programiz
programiz.com › javascript › examples › extract-value-array
JavaScript Program to Extract Given Property Values from Objects as Array
// program to extract value as an array from an array of objects function extractValue(arr, prop) { let extractedValue = []; for (let i=0; i < arr.length ; ++i) { // extract value from property extractedValue.push(arr[i][prop]); } return extractedValue; } const objArray = [{a: 1, b: 2}, {a: ...
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Array
Array - JavaScript - MDN Web Docs
Returns the array item at the given index. Accepts negative integers, which count back from the last item. ... Returns a new array that is the calling array joined with other array(s) and/or value(s).
🌐
YouTube
youtube.com › watch
JavaScript Question: How Do I Find and Extract a Value from an Array? - YouTube
JavaScript arrays have a wealth of methods that can be used for working with them. In this tutorial we will look at one of those methods. Find can be used fo...
Published: July 8, 2020