JSFiddle - React, Tailwind, and code Playground

by dhoerster

HTML

Functions taking functions
<br/><hr/>

<ul></ul>

JavaScript

var agileWays = agileWays || {},
    theUL = $('ul'),
    hiFunc = function(text) { return text; },
    writer = function(f,t) { theUL.append('<li>' + f(t) + '</li>'); },
    funcInstance;

funcInstance = function(t) { writer(hiFunc,t); };
agileWays.sayHi = funcInstance;
agileWays.sayHi('hi');
agileWays["sayHi"]('hello');

var funcName = "sayHi";
agileWays[funcName]('well, how do you do?');