Mark Wilson I am the creator of TopXML. I am available for international and local (Australia) contracts. I am a Solution Architect/Business Analyst. I have worked in IT in several countries (NZ, Australia, South Africa, UK) building and training teams for government and very large non-governmental organizations. I am ex-Microsoft Consulting Services. I wrote the first book on Microsoft XML published in 2000 called XML Programming with VB and ASP. Most recently I have been building tools for the SEO industry. Ask me for a 37 point SEO health-checkup for your website.
First posted :
03/24/2008
Times viewed :
2714
JavaScript Boolean Object
Introduction
The Boolean object is a wrapper for the Boolean data type.
If you pass no value, 0, "" false, undefined or NAN then it will
evaluate to false. However if you pass this value to an if condition then it
will return true. So don’t confound the Boolean object with the boolen data
type. Everything else passed into the object of Boolean will return true.
Example
<html>
<head>
<script type="text/javascript">
// Returns
false
document.write("Returns
false:<br/>")
document.write(b
= new Boolean("") + "<br/>")
document.write(b
= new Boolean() + "<br/>")
document.write(b
= new Boolean(false) + "<br/>")
document.write(b
= new Boolean(NaN) + "<br/>")
document.write(b
= new Boolean(null) + "<br/>")
document.write(b
= new Boolean(undefined) + "<br/>")