// 
var StateJS;
//  function 
(function (StateJS) {
    var Behavior = (function () {
        // 
        function Behavior(behavior) {
            this.actions = [];
            if (behavior) {
                this.push(behavior); // NOTE: this ensures a copy of the array is made
            }
        }
        // 
        Behavior.prototype.push = function (behavior) {
            Array.prototype.push.apply(this.actions, behavior instanceof Behavior ? behavior.actions : arguments);
            return this;
        };
        /**
         * Tests the Behavior instance to see if any actions have been defined.
         * @method hasActions
         * @returns {boolean} True if there are actions defined within this Behavior instance.
         */
        Behavior.prototype.hasActions = function () {
            return this.actions.length !== 0;
        };     
        Behavior.prototype.invoke = function (message, instance, history) {
            if (history === void 0) { history = false; }
            this.actions.forEach(function (action) { return action(message, instance, history); });
        };
        //  var Behavior = 
        return Behavior;
    })();
    //  StateJS
    StateJS.Behavior = Behavior;
//  StateJS StateJS {}
})(StateJS || (StateJS = {})); see the above code on the Internet, the above definition constructor can be written in the following form, I have never seen this kind of writing before, who can explain it. 
 function Behavior (behavior) {
        this.actions = [];
        if (behavior) {
            this.push(behavior); // NOTE: this ensures a copy of the array is made
        }
    }-sharp-sharp-sharp 
the environmental background of the problems and what methods you have tried
related codes
/ / Please paste the code text below (do not replace the code with pictures)
