What will happen when 1 is converted to Boolean in JavaScript?

HTMLJavascriptProgramming Scripts

You can try to run the following code to learn how to convert 1 to Boolean in JavaScript −

Example

Live Demo

<!DOCTYPE html>
<html>
   <body>
      <p>Convert 1 to Boolean</p>
      <script>
         var myVal = 1;
         document.write("Boolean: " + Boolean(myVal));
      </script>
   </body>
</html>
raja
Published on 26-Feb-2018 14:14:07
Advertisements