UNPKG

ibm-india-rajtgin

Version:

This is my IBM Oct training module

19 lines (15 loc) 344 B
/** * Created by Raj on 10/24/2016. */ var heroes = ["Batman", "Ironman", "Spiderman", "Superman"]; var powers = [3,2,7,5,1,1,6]; function sortfun(arg1, arg2){ if (arg1 < arg2) { return -1 }else if(arg1 > arg2) { return 1 }else { return 0 }; }; console.log(powers.sort(sortfun));