尼莫叮

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

//****** Function & function & 隐式function
	// Function 是javaScript中的保留字,用来显式的定义函数对象。 前n个参数作为定义函数的参数,最后一个参数为定义函数的函数体
	var test = new Function("cs1","cs2","alert(cs1+cs2)");
	test(1,2);
	
	// function 后加函数的名字方式来定义函数
	function test(cs1,cs2)
	{
		alert(cs1+cs2);
	}
	test(1,2)
	var test1 = test;
	test1(1,2);
	
	// 隐式function
	var test = function(cs1,cs2)
	{
		alert(cs1+cs2);
	}
	test(1,2);
	
	// 创建的函数变量是对象,我们就可以给变量添加新的属性和方法
	test.love = "i love php";
	alert(test.love);
	test.php=function(msg)
	{
		alert(msg);
	}
	test.php("how to study php!");

  

posted on 2013-02-20 10:05  尼莫叮  阅读(186)  评论(0编辑  收藏  举报