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

How is NaN converted to String in JavaScript?


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

Example

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