<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script>
function fn1(a){
if(typeof a==='number' && a===a) //a是数字且不是NaN
{
alert(a+8);
}else if(typeof a==='string'){
alert(a.charAt(3));
}else if(typeof a==='function'){
a();
}
}
fn1(100);
fn1('marie');
fn1(function(){
alert('tony');
});
</script>
</head>
<body>
</body>
</html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script>
function fn1(a){
if(typeof a==='number' && a===a) //a是数字且不是NaN
{
alert(a+8);
}else if(typeof a==='string'){
alert(a.charAt(3));
}else if(typeof a==='function'){
a();
}
}
fn1(100);
fn1('marie');
fn1(function(){
alert('tony');
});
</script>
</head>
<body>
</body>
</html>