<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<script type="text/javascript">
//参数 = js的数据类型(基本类型和引用类型)
//数字.字符串.布尔.函数.对象.未定义.数组
fnc(100);
fnc('stlying');
fnc(function() {
alert(222);
});
function fnc(e) {
if(typeof e === 'number' && e === e) {
alert(e + 5)
} else if(typeof e === 'string') {
alert(e.charAt(3))
} else if(typeof e === 'function') {
e();
}
}
//例子
fun(window,document);
function fun(win,doc){
win.onload = function(){
doc.body.innerHTML ="你好,js";
}
}
//return返回值
alert(fn()) //return ==>等价于fn()==>100
function fn(){
return 100
}
//传的参数只能一一对应
</script>
</body>
</html>