How is NaN converted to Number in JavaScript?

JavascriptWeb DevelopmentFront End Scripts

You can try to run the following to learn how to convert NaN to Number in JavaScript −

Example

Live Demo
<!DOCTYPE html>
<html>
   <body>
      <p>Convert NaN to Number</p>
      
      <script>
         var val = NaN;
         document.write("Number : " + Number(val));
      </script>
      
   </body>
</html>
raja
Published on 26-Feb-2018 07:53:24
Advertisements