Home > Article > Web Front-end > How to directly declare an object in js_Basic knowledge
var ctrl = { init: function(){ this.a(); this.b(); }, name : "zs", a: function(){ alert("aa"); }, b: function(){ alert("bb"); } }; var str = ctrl.name; console.info(str); //zs ctrl.init(); //弹出aa,bb