javascript 函数

来源:互联网 发布:c语言编写最简单的游戏 编辑:程序博客网 时间:2024/05/21 10:25
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb18030" /><title>Untitled Document</title><script type="text/javascript">//定义了一个函数,用于返回1function show(){return 1;}//调用show(),自然返回了1,然后alert("1");alert(show());//而对于这个,并不是调用了show(),而是输出了这个函数的对象的引用alert(show);//比如有:下面就是相当于把show的这个对象的引用赋给了变量demovar demo=show;//然后demo()相当于执行了show()alert(demo());</script></head><body></body></html>

原创粉丝点击