How to make a function that iterates through an array?

Hello!

Task:
screenshot.su/show.php?img=7c9cfc2d6e2a5ca587d409b...

Code:
https://jsfiddle.net/q9qhnLq2/

As I understand it,you need to make a function that will iterate over array or can be done another way?
What hour fighting over this garbage,nothing comes out

Thanks in advance!
June 10th 19 at 14:42
2 answers
June 10th 19 at 14:44
Solution
What is the array you want to iterate over?

In General, methods are: Array: sort methods
avatars,in order to cram it in a similar way

screenshot.su/show.php?img=e3577dce9057719336d0a5b...

Only now I have the function pulls a random element and they are repeated - nikita.Stracke commented on June 10th 19 at 14:47
there are options
1. pre-shuffle the list.
2. to check, did not come across this item before, and pull the other. (but it will be very inefficient on large lists, which come to an end)
3. to remove the element, who pulled the arr.splice(n, 1)

PS: the Code image is very bad form. Especially when it is a link, not img. - Austen.Thompson53 commented on June 10th 19 at 14:50
Code I didn't send the picture,code fidle,a picture of a small piece of the task - nikita.Stracke commented on June 10th 19 at 14:53
June 10th 19 at 14:46
Solution
Here is sort of create 8 objects with different avatars like in the job click

z.s. you have a test task for knowledge of OOP, read about it

Find more questions by tags JavaScript