JSFiddle - React, Tailwind, and code Playground

JavaScript

var Controller= function(){
	this.currentpage='home';
	
}

Controller.prototype.route=function(where){

	window["Controller."+where]();
};

Controller.prototype.goHome=function(){
	alert('route gohome');

}

Controller.prototype.goBack=function(){
	alert('route goback');

}

//////
test=new Controller();
test.route('goHome');