JSFiddle - React, Tailwind, and code Playground

by Fernando Leal

JavaScript

function a(nomeDaFuncao) {

  this.b  = function(param) {
      alert("b " + param);
  }

  this.c = function(param) {
      alert("c " + param);
  }

  console.log(this);
  this[nomeDaFuncao]("oi");
}

a("c");