forked from GitHub/dbot
		
	Sum function.
This commit is contained in:
		
							parent
							
								
									f9538183fb
								
							
						
					
					
						commit
						cfe2c0db4f
					
				| @ -27,6 +27,14 @@ Array.prototype.include = function(value) { | ||||
|     return false; | ||||
| }; | ||||
| 
 | ||||
| Array.prototype.sum = function() { | ||||
|     var sum = 0; | ||||
|     for(var i=0;i<this.length;i++) { | ||||
|         sum += (parseFloat(this[i]) || 0); | ||||
|     } | ||||
|     return sum; | ||||
| }; | ||||
| 
 | ||||
| Array.prototype.allGroupings = function() { | ||||
|     if (this.length == 0) { | ||||
|         return [];  /* short-circuit the empty-array case */ | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Psychedelic Squid
						Psychedelic Squid