Examples are as follows:
var LILL ={};//Create global(function (wd) {function $(id) {return document.getElementById(id);}function alertNodeName(id) {alert($(id).nodeName);}var name = "aaaa"; function showName()//Function{alert(name);}alert(wd);wd['test'] = {};//Create object wd['test']['debuglog'] = alertNodeName;wd['test']['name'] = name;showName();})(LILL); and then refer to the written js file, and then call <script>window.onload=function () {alert("test");LILL['test']['debuglog']('AA');}</script>The above article uses pseudo-namespace encapsulation to protect objects created independently is all the content I share with you. I hope you can give you a reference and I hope you can support Wulin.com more.