Guest User

Untitled

a guest
Oct 20th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. function sortAsc(x, y) {
  2. if (question2 == "up") {
  3. if (question1 == "name") {
  4. var ayy = x.name.toLowerCase();
  5. var byy = y.name.toLowerCase();
  6. if (ayy < byy) {
  7. return -1;
  8. }
  9. if (ayy > byy) {
  10. return 1;
  11. }
  12. return 0;
  13. } else {
  14. return x.itemsBought - y.itemsBought;
  15. }
  16. }
  17. }
  18.  
  19. function sortDesc(x, y) {
  20. return -1 * sortAsc(x, y);
  21. }
Add Comment
Please, Sign In to add comment