animals

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision Both sides next revision
animals [2020/03/25 00:05]
saph
animals [2020/03/29 23:21]
saph updated sorting function
Line 260: Line 260:
  
             if (dir == "asc") {             if (dir == "asc") {
-                if (x.innerHTML.toLowerCase() > y.innerHTML.toLowerCase()) {+                if ((!isNaN(x.innerHTML) && parseFloat(x.innerHTML) > parseFloat(y.innerHTML)) || 
 +                        (isNaN(x.innerHTML) && x.innerHTML.toLowerCase() > y.innerHTML.toLowerCase())) {
                     shouldSwitch = true;                     shouldSwitch = true;
                     break;                     break;
                 }                 }
             } else if (dir == "desc") {             } else if (dir == "desc") {
-                if (x.innerHTML.toLowerCase() < y.innerHTML.toLowerCase()) {+                if ((!isNaN(x.innerHTML) && parseFloat(x.innerHTML) < parseFloat(y.innerHTML)) || 
 +                        (isNaN(x.innerHTML) && x.innerHTML.toLowerCase() < y.innerHTML.toLowerCase())) {
                     shouldSwitch = true;                     shouldSwitch = true;
                     break;                     break;
  • animals.txt
  • Last modified: 2022/03/17 16:12
  • by aster