1.typeof 操作符 主要检测基础数据类型 var a="zhangqian"; var b=true; ; var d; var e=null; var f=new Object(); function add(a,b){ return a+b; } var tmp = new add(); alert(typeof a); //string alert(typeof b); //number alert(typeof c); //boolean alert(typeof d);
Java调用system.print.out()是会调用toString方法打印js里的console.log也是控制台打印,很多时候,我们以为也是调用toString方法,其实并不是.我们在chrom下测试 var obj={'a':2}; console.log(obj); console.log(arr.toString());{'a':2} console.log(obj.toString());[object Object] console.log(obj+'');[object Ob
function checkcc() { var reg = new RegExp("^[0-9]*$"); var obj = document.getElementById("moneyc"); if(obj.value=="") { alert("不能为空!"); return false; } if(!reg
<script type="text/javascript"> function checkRoleName(){ var userName=document.getElementById("roleName").value; if(userName.replace(/\s/g,'')==''){ alert("请输入角色名称"); document.getElementById("roleName").focus