0

I am trying to reorganize an array to use it in a for loop. I have tried slicing it then merging with sliced elements but i get the error

TypeError: images.slice(...).merge is not a function

Here is an example of what I am trying

var images = ["0", "1", "2", "3", "4", "5"];
var f_iamges = images.slice(2).merge(images.slice(0, 2))

console.log(f_iamges)

I expected output ["2", "3", "4", "5", "0", "1"] I also want the original copy to remain unchanged.

1 Answer 1

3

Try with concat:

images.slice(2).concat(images.slice(0, 2))
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.