JSFiddle - React, Tailwind, and code Playground

by Michael Prosser

JavaScript

var machinelearning = {};

machinelearning.functions = Array();

machinelearning.functions['waystosayhi'] = Array();

machinelearning.create_function = function(function_name,params){

var index = machinelearning.functions[function_name].length;

	var js = 'machinelearning.' + function_name + '_' + index + ' = function(' + params + '){ alert(\'' + params + '\'); }';
  
  eval(js);
  
  machinelearning.functions[function_name].push(function_name);

}

machinelearning.run = function(function_parentname){

	for(var i=0;i<machinelearning.functions[function_parentname].length;i++){
  
    var js = 'machinelearning.' + function_parentname + '_' + i + '();';
    
  	eval(js);
  
  }
}

// called stuff

machinelearning.create_function('waystosayhi','hi');
machinelearning.create_function('waystosayhi','hello');
machinelearning.create_function('waystosayhi','howdy');
machinelearning.create_function('waystosayhi','yo');

machinelearning.run('waystosayhi');