JSFiddle - React, Tailwind, and code Playground

JavaScript

Function.prototype.attachCallListener = function(f) {
    var self = this;
    return function() {
        f();
        return self.apply(this,
            [].slice.call(arguments)
        );
    };
};

var f = function() {
    alert(['test'].concat(
        [].slice.call(arguments)
    ));
};
         
f = f.attachCallListener(function() {
    alert('f is called.');
});

f(1, 2, 3);