JQuery > 创建方法(函数)方法

创建函数,方式一

var fun1 = new Function("a", "b", "alert(a);")
fun1(1, 2);
这种方式用的及其的少

创建函数,方式二

var fun2 = function(a,b){
	document.write("Result is (sum) :" + (a+b))
}
fun2(2,3);

创建函数,方式三

function fun3(a,b){
	console.log("Result is (sum) :" + (a+b));
}
fun3(3,4);

猜你喜欢

转载自blog.csdn.net/weixin_43309893/article/details/120174042