Created
September 6, 2013 17:06
-
-
Save jdjkelly/6466706 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var sortedCoupons = [] | |
var coupons = Object.keys(Store.Menu.Coupons) | |
coupons.forEach(function(coupon, index, coupons) { | |
data = Store.Menu.Coupons[coupon] | |
sortedCoupons.push(data) | |
}) | |
sortedCoupons.sort(function (a, b) { | |
if (parseFloat(a.Price) > parseFloat(b.Price)) | |
return 1; | |
if (parseFloat(a.Price) < parseFloat(b.Price)) | |
return -1; | |
// a must be equal to b | |
return 0; | |
}); | |
sortedCoupons.forEach(function(coupon, index, coupons) { | |
console.log(coupon.Price, coupon.Name, coupon.Code) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment