How to initialiaze an object and assign different variables javascript

前端 未结 1 1714
独厮守ぢ
独厮守ぢ 2021-01-17 06:38

I have created an object where i need to assign some variables(parameters) and when the object is called, the variables(parameters) change. Here is my code:

         


        
相关标签:
1条回答
  • 2021-01-17 07:23

    it is Done like this way,

    i Guess this is what you want to do.

    var Modal = {
    
        init: function (args) {
    
                  //then access your values like this
                contact1=   args.contact1;
                contact2 = args.contact2;
                ..........
                .........
                .........
             }
    }
    

    And to initiate this method you have write as

    Modal.init({
    contact1:"contact str",
    contact2:"contact str",
    .....
    .....
    lastitem : "last str"
    });
    
    0 讨论(0)
提交回复
热议问题