这篇文章主要介绍了js函数与php函数的区别,以实例形式较为简单的分析了js函数与php函数语法及应用上的不同点,具有一定参考借鉴价值,需要的朋友可以参考下
本文实例分析了js函数与php函数的区别。分享给大家供大家参考。具体分析如下:
在PHP语法中,函数就是语法上的结构体,不是一个变量,不能被赋值;
在JS中,函数也是一种变量,变量名就是函数名。
<html>
<head>
</head>
<body>
<script type="text/javascript">
function t(){
return 5;
}
var m = t;//函数名即是变量名。注意,不能写成t(),加括号是表示调用这个函数。
alert(m());
</script>
</body>
</html>所以,声明函数也可以这样:
t = function(参数){
函数体;
}
js regular expression
The difference between static web pages and dynamic web pages
What is the difference between 4g and 5g mobile phones?
The difference between k8s and docker
js gets current time
The difference between JD.com's self-operated flagship store and its official flagship store
js string to array
what does js mean