I'm using Javascript and JSONP and want to find-out a user's total badge-count (i'm not using any libraries).
At first I naively added up the badge counts individually, but some user's have no badges. I also want to make sure it keeps working if the API changes to only list badge types the user has or a platinum badge is added.
I can't iterate through them either and userInfo.badge_counts.length is undefined.
What is the best way to do this?