JSFiddle - React, Tailwind, and code Playground

JavaScript

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

Controller.prototype.route=function(where){
	this[where]();
};

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

}

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

}

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