Each time you pass a different value to the instance method, can you not override the value of the property on the constructor?

constructor
function layer_custom() {
    this.json = {
        type: "",
        title: null,
        content: "",
        area: "",
        //skin:"layui-layer-rim",
        //offset:
        btnAlign: "c",
        closeBtn: null,
        // shade: 0,
        shade: [.1, "-sharp000"],
        shadeClose: false,
        time: 0,
        id: "onlyOne",//id
        anim: 0,
        resize: false,
        yes: null,
        no: null,
        cancel: null,
        btn1: null,
        btn2: null,
        btn3: null
    }
}
instance method
// 3
layer_custom.prototype.alertCustBtn = function(id, title, Arrbtn, content, area, fn, fn1, fn2, suc, destory) {
    this.json.type = 1;
    this.json.id = id;
    this.json.btn = Arrbtn; //Arrbtn 
    this.json.title = title;
    this.json.closeBtn = 1;
    this.json.content = content;
    this.json.area = area;
    this.json.btn1 = function(index, layero) {
        fn && fn(index);
        // layer.close(index);
    };
    this.json.btn2 = function(index) {
        fn1 && fn1(index);
        // layer.close(index);
    };
    this.json.btn3 = function(index) {
        fn2 && fn2(index);
        // layer.close(index);
    };
    this.json.success = function() {
        suc && suc();
    }
    this.json.end = function() {
        destory && destory();
    }
    layer.open(this.json);
};
calling code
 var did = "dialog1";
   //layer_customiddialog1
   //alertCustBtndialog1

    $layer.alertCustBtn(did, "", [""], "", ["840px", "600px"], (index) => {
        layer.close(index);
    }, null, null, () => {
        _tpl.layuiTplRender("caseDetailPanel_tpl", did, {});
    });
at present, the id on layer_custom is overwritten as dialog1.
but the value on the constructor becomes dialog1 the next time you call alertCustBtn. Can you make the constructor not record the last value passed, but use the default attribute value on the constructor every time I call the instance method without overwriting the property?
Feb.28,2021

because you have written all the attributes on the prototype chain
layer_custom.prototype.alertCustBtn = function () {}
, the this of this function is equivalent to layer_custom.prototype;, and this is shared by all instances, you can bind the properties to the constructor and put the common methods on the prototype chain

function layer_custom (id, title, Arrbtn, content, area, fn, fn1, fn2, suc, destory) {

this.json = {
    id: id
    //...
}

}

it is recommended to take a look at the elevation

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e585ab-454b3.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e585ab-454b3.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?