javascript 两个感叹号

var foo1,
	foo2 = 0,
	foo3 = "",
	foo4 = null,
	foo5 = 1,
	foo6 = "0",
	foo7 = "1",
	foo8 = [],
	foo9 = {};
		
document.write("var: " + !!foo1 + "
"); //false document.write("0: " + !!foo2 + "
"); //false document.write("\"\": " + !!foo3 + "
"); //fasle document.write("null: " + !!foo4 + "
"); //false document.write("1: " + !!foo5 + "
"); //true document.write("\"0\": " + !!foo6 + "
"); //true document.write("\"1\": " + !!foo7 + "
"); //true document.write("[]: " + !!foo8 + "
"); //true document.write("{}: " + !!foo9 + "
"); //true
 

你可能感兴趣的:(Javascript)