JSFiddle - React, Tailwind, and code Playground

HTML

<div></div>

JavaScript

;(function($) {
    
    var myValue;
    
    $.myplugin = {
    
        myValue: function(value) {
            
            if (typeof(value) != "undefined") {
                myValue = value;
            } else {
                return myValue;
            }
            
        }
    
    }
    
})(jQuery);


jQuery.myplugin.myValue("test");
alert($.myplugin.myValue());

jQuery.myplugin.myValue(10);
alert($.myplugin.myValue());