Just wondering why this doesn't work. This actually came up in our CanJS Boston meetup last night:
- Numbers = can.List.extend({sum: can.compute(function() {var sum = 0;this.each(function(val) {sum += val;});return sum;})})var nums = new Numbers([1,2,3]);nums.sum();
It fails with: Uncaught TypeError: Object [object global] has no method 'each'
"this" is equal to the global object when the compute is called.
Is something that you shouldn't be or need to do?