JavaScript DHTML/Language Basics/Boolean

Материал из Web эксперт
Перейти к: навигация, поиск

Boolean Object

   <source lang="html4strict">

<html> <body> <script type="text/javascript"> 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") document.write("0 is boolean "+ b1 +"
") document.write("1 is boolean "+ b2 +"
") document.write("An empty string is boolean "+ b3 + "
") document.write("null is boolean "+ b4+ "
") document.write("NaN is boolean "+ b5 +"
") document.write("The string "false" is boolean "+ b6 +"
") </script> </body> </html>


      </source>