Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. function ReOrder(vector, vectors){
  2. var pom = 0;
  3. var index = 0;
  4. var j = 0;
  5. var pole = [];
  6.  
  7. vectors.forEach(function(vect){
  8. vect.forEach(function(x){
  9. pom += (vector[index] - x);
  10. index++;
  11. });
  12.  
  13. var item = [pom, vectors[j++]];
  14. pole.push(item);
  15. pom = 0;
  16. index = 0;
  17. });
  18.  
  19. pole = pole.sort();
  20. return pole.map(item => item[1]);
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement