Computer >> Computer tutorials >  >> Programming >> Javascript

How is NaN converted to Number in JavaScript?


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

Example

<!DOCTYPE html>
<html>
   <body>
      <p>Convert NaN to Number</p>
      
      <script>
         var val = NaN;
         document.write("Number : " + Number(val));
      </script>
      
   </body>
</html>