JSFiddle - React, Tailwind, and code Playground

JavaScript

var core_slice = Array.prototype.slice;

jQuery.proxy = function( fn, context )
    
    {

        var tmp, args, proxy;

        if ( typeof context === "string" ) {
            tmp = fn[ context ];
            context = fn;
            fn = tmp;
        }

        // Quick check to determine if target is callable, in the spec
        // this throws a TypeError, but we will just return undefined.
        if ( !jQuery.isFunction( fn ) ) {
            return undefined;
        }

        // Simulated bind
        args = core_slice.call( arguments, 2 );

        proxy = function() {
            return fn.apply( context || this, args.concat( core_slice.call( arguments ) ) );
        };

        // Set the guid of unique handler to the same of original handler, so it can be removed
        proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;

        return proxy;
    };

function Carousel (title)
{
    this.title = title;
}

(function()
{

    function animate(action, duration, easing)
    {
        document.write('animate "' + this.title + '" to ' + action +
                       ' with duration of ' + duration + ' and ' + easing + ' easing<br>');
    }

    Carousel.prototype.goNext = jQuery.proxy(animate, null, '+1');
    Carousel.prototype.goPrev = jQuery.proxy(animate, null, '-1');


})();
 
var slider = new Carousel('carousel');

slider.goNext(100, 'linear');
slider.goPrev(999, 'custom');


// example from prototype documentation
String.prototype.splitOnSpaces = jQuery.proxy(String.prototype.split, null, " ");
document.write("foo bar baz thud".splitOnSpaces().join(', '));