Home >Backend Development >PHP Tutorial >Another way to write js to share
This article mainly shares with you another way to write js, a way to prevent duplication of method names. It mainly explains it to you with a piece of code. I hope it can help you.
var mytest = function() { return { test1:function () { alert("this is a test1 func"); } test2: function () { alert("this is a second func"); } }; }();
Use mytest.test1() when calling
The above is the detailed content of Another way to write js to share. For more information, please follow other related articles on the PHP Chinese website!