Last active
January 19, 2019 11:10
-
-
Save ayuLiao/a3ec30fbc0651bc550cb2e69819dd2ad to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//原生JS定义方法 | |
var x = function (a, b) {return a * b}; | |
var z = x(4, 3); | |
//定义多个方法,将方法统一放到一个对象里,以传递一个字符串为例: | |
//方法定义 ,需要导入jquery | |
$.func = { | |
//定义一个方法aa | |
aa: function(param) { | |
alert("aaaaaa" + param); | |
}, | |
//定义一个方法bb | |
bb: function() { | |
alert("bb"); | |
} | |
} | |
$.func.aa('123'); //调用$.func里的aa方法 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment