Advertisement
Guest User

Untitled

a guest
Aug 21st, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. // Объект который итерируем ---> this.circleUserInfo.stats
  2. // Заменяем нижнее подчеркивание ---> sortable.push([key.replace('_', ' '), props[key]]);
  3.  
  4. newScorableArray() {
  5. if (!this.circleUserInfo.stats)
  6. return [[,]];
  7. let sortable = [];
  8.  
  9. const props = extractProperties(this.circleUserInfo.stats);
  10. for (let key in props) {
  11. if (props.hasOwnProperty(key))
  12. sortable.push([key.replace('_', ' '), props[key]]);
  13. }
  14. return sortable
  15. .sort((a, b) => b[1] - a[1])
  16. .splice(0, 5);
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement