InterviewSolution
Saved Bookmarks
| 1. |
What is Window alert() in JavaScript |
|
Answer» “True” and “False” are the two values in a Boolean object. Let us now see how to create a Boolean object: var val = NEW Boolean(false);Let us now see an example wherein we will create a Boolean object and return the value. We are using Boolean VALUEOF() method: <!DOCTYPE html> <html> <body> <SCRIPT> var val = new Boolean(true); document.write( "Value = " + val.valueOf() ); </script> </body> </html>The output: Value = trueHere is another example wherein we are returning the string representation of a Boolean value: <!DOCTYPE html> <html> <body> <script> var val = new Boolean(false); document.write( "String = " + val.toString() ); </script> </body> </html>The output: String = false |
|