JSFiddle - React, Tailwind, and code Playground

by David Thomas

JavaScript

var fn = {
    'banana' : function () {
        return 'A function called "banana" was exectuted.';
    },
    'orange' : function () {
        return 'the "orange" function was called.';
    },
    'anotherName' : function () {
        return 'The function going by the name of "anotherName" was called.';
    }
},
    functions = Object.keys( fn );

console.log(fn[functions[Math.floor(Math.random() * functions.length)]]());