javascript中普通函数的使用介绍

时间:2013-12-19    点击:98   
复制代码 代码如下:

<html>
<head>
<title>javascript中普通函数的使用</title>

<script>
function show(){
document.write("show函数被调用" + "<br/>");
return 10;
}

var hello = show();//show()函数被调用,将返回值赋值给hello变量。如果函数没有返回值,则返回undefined
document.write(hello + "<br/>");//10

var hello2 = show;//show和hello2指向同一个函数
document.write(hello2 + "<br/>");//打印出show的函数体

hello2();//等同于调用show()函数

</script>

</head>
<body>

</body>
</html>
jquery prop的使用介绍及与attr的区别
js获取select选中的option的text示例代码
js 高效去除数组重复元素示例代码
javascript中字符串的定义示例代码
javascript中typeof的使用示例
> 返回     
地址:上海市普陀区胶州路941号长久商务中心 电话: QQ:
© Copyright 2012 上海网络 Product All Rights Reserved