在javascript中普通函数的使用介绍
发布时间:2023-09-01 14:42:52 所属栏目:教程 来源:
导读:代码如下:
<html>
<head>
<title>javascript中普通函数的使用</title>
<script>
function show(){
document.write("show函数被调用" + "<br/>");
return 10;
}
var hello = sho
<html>
<head>
<title>javascript中普通函数的使用</title>
<script>
function show(){
document.write("show函数被调用" + "<br/>");
return 10;
}
var hello = sho
代码如下: <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> (编辑:聊城站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
推荐文章
站长推荐