jweinst1
5/20/2016 - 6:09 PM

sum automatan in javascript

sum automatan in javascript

//summation automatan demo

//useful for building sequences or summation
var SummAutomatan = (function(){
	function SummAutomatan(amount){
		this.amount = amount;
		this.next = null;
	}
	SummAutomatan.prototype.append = function(){
		if(this.next === null){
			this.next = new SummAutomatan(this.amount + 1);
		}
		else {
			this.next.append();
		}
	};
	return SummAutomatan;
})();