日期:2014-05-16  浏览次数:20514 次

javascript 两个感叹号
var foo1,
	foo2 = 0,
	foo3 = "",
	foo4 = null,
	foo5 = 1,
	foo6 = "0",
	foo7 = "1",
	foo8 = [],
	foo9 = {};
		
document.write("var: " + !!foo1 + "<br>"); //false
document.write("0: " + !!foo2 + "<br>"); //false
document.write("\"\": " + !!foo3 + "<br>"); //fasle
document.write("null: " + !!foo4 + "<br>"); //false
document.write("1: " + !!foo5 + "<br>"); //true
document.write("\"0\": " + !!foo6 + "<br>"); //true
document.write("\"1\": " + !!foo7 + "<br>"); //true
document.write("[]: " + !!foo8 + "<br>"); //true
document.write("{}: " + !!foo9 + "<br>"); //true
?