3
A feature I use a lot in C# is delegate which is a reference type used to reference anonymous or named methods. Especially classes already implemented in framework like the Action and the Func, as an example below.
public class Program
{
    public static void Main
    {
        ExibirMensagem((s) => 
        {
            Console.WriteLine(s);
        });
    }
    public static void ExibirMensagem(Action<T> actMensagem)
    {
        actMensagem("Exibiu a mensagem");
    }
}
I would need something similar to this, but in Javascript. I’m new to Javascript and I don’t know how to do this, it might be something very simple. In Java 6 that does not support this type of behavior, I remember that to get around it and do something similar I used an interface that could be implemented anonymously, as an example below:
public interface IAcao {
    void Executar(String str);
}
public class Program {
    public static void Main(string[] args) {
        ExecutarAcao(new IAcao() {
            @Override
            public void Executar(String str) {
                Log.v("Exec", str);
            }
        });
    }
    public static void ExecutarAcao(IAcao delAcao) {
        delAcao.Executar("Executou Ação");
    }
}
This approach is possible in Javascript?