Home >Web Front-end >JS Tutorial >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