I have array=[a, b, c, d] and I want to return the elements in a numbered string like "1. a, 2. b, 3. c, 4. d"
I have tried using a for loop using the index i to return "i. array[i]", but I only get the first element of the array returned, not the whole array.
const array = ["a", "b", "c", "d"]
for (var i = 0; i < array.length; i++) {
return `The order is currently: ${i+1}. ${array[i]}, `
}
I expect the output to be "The order is currently 1. a, 2. b, 3. c, 4. d", but the actual output is "1. a,"