Skip to content

Instantly share code, notes, and snippets.

@an-sangkil
Created November 6, 2013 08:19
Show Gist options
  • Save an-sangkil/7332640 to your computer and use it in GitHub Desktop.
Save an-sangkil/7332640 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="[자바스크립트 Boolean 변수 테스트]" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js">
</script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
</body>
</html>
var result = new Boolean(1);
var b1=new Boolean(0);
var b2=new Boolean(1);
var b3=new Boolean("");
var b4=new Boolean(null);
var b5=new Boolean(NaN);
var b6=new Boolean("false");
var test = 'false';
var test1 = false;
var b7=new Boolean(test);
var b8=new Boolean(test1);
console.log('boolean data test1');
console.log(result);
console.log(b1);
if(b1.valueOf()) {
console.log('data is true');
} else {
console.log('data is false');
}
document.write("0 is boolean "+ b1 +"<br>");
document.write("1 is boolean "+ b2 +"<br>");
document.write("An empty string is boolean "+ b3 + "<br>");
document.write("null is boolean "+ b4+ "<br>");
document.write("NaN is boolean "+ b5 +"<br>");
document.write("The string 'false' is boolean "+ b6 +"<br>");
document.write("The string 'false' is boolean "+ b7+"<br>");
document.write("The 'false' is boolean "+ b8+"<br>");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment