jweinst1
8/4/2016 - 1:45 AM

constructors in a dictionary

constructors in a dictionary

//multi constructor

//random number function
var randNumber = function(x, y){
	return Math.floor((Math.random() * y) + x);
};

var nodes = {
	"+":function(){
		this.a = randNumber(1, 5);
		this.b = randNumber(1, 5);
	},
	"-":function(){
		this.a = randNumber(1, 3);
		this.b = randNumber(1, 7);
	}
};