调用
function func1(a){
if(a!=null){
if(a.length){
alert("array";
}else{
alert("is not array")
}
}
}
出来的结果是"array"
--------------------------
<script>
var a=new Array(1,2,3);
var b=2;
var c="2eee";
document.write(" The type of is " + typeof(a) );
document.write(" The type of is " + typeof(b) );
document.write(" The type of is " + typeof(c) );
//alert(a.length);
if(c!=null){
if(c.length){
alert("array");
}else{
alert("is not array")
}
<script language=javascript>
var a=new Array(1,2,3);
var b=2;
var c="2eee";
document.write(" The type of is " + typeof(a) );
document.write(" The type of is " + typeof(b) );
document.write(" The type of is " + typeof(c) );
alert(a.length);