what is the difference between isNaN and Number.isNaN? [duplicate]












0
















This question already has an answer here:




  • Confusion between isNaN and Number.isNaN in javascript

    4 answers




what is the difference between isNaN and Number.isNaN?



isNaN('hello world'); // returns 'true'.
Number.isNaN('hello world'); // returns 'false









share|improve this question













marked as duplicate by Mark Meyer javascript
Users with the  javascript badge can single-handedly close javascript questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 19 '18 at 19:19


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.























    0
















    This question already has an answer here:




    • Confusion between isNaN and Number.isNaN in javascript

      4 answers




    what is the difference between isNaN and Number.isNaN?



    isNaN('hello world'); // returns 'true'.
    Number.isNaN('hello world'); // returns 'false









    share|improve this question













    marked as duplicate by Mark Meyer javascript
    Users with the  javascript badge can single-handedly close javascript questions as duplicates and reopen them as needed.

    StackExchange.ready(function() {
    if (StackExchange.options.isMobile) return;

    $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
    var $hover = $(this).addClass('hover-bound'),
    $msg = $hover.siblings('.dupe-hammer-message');

    $hover.hover(
    function() {
    $hover.showInfoMessage('', {
    messageElement: $msg.clone().show(),
    transient: false,
    position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
    dismissable: false,
    relativeToBody: true
    });
    },
    function() {
    StackExchange.helpers.removeMessages();
    }
    );
    });
    });
    Nov 19 '18 at 19:19


    This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.





















      0












      0








      0


      0







      This question already has an answer here:




      • Confusion between isNaN and Number.isNaN in javascript

        4 answers




      what is the difference between isNaN and Number.isNaN?



      isNaN('hello world'); // returns 'true'.
      Number.isNaN('hello world'); // returns 'false









      share|improve this question















      This question already has an answer here:




      • Confusion between isNaN and Number.isNaN in javascript

        4 answers




      what is the difference between isNaN and Number.isNaN?



      isNaN('hello world'); // returns 'true'.
      Number.isNaN('hello world'); // returns 'false




      This question already has an answer here:




      • Confusion between isNaN and Number.isNaN in javascript

        4 answers








      javascript






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 19 '18 at 19:15









      Eng Abdullah MorsyEng Abdullah Morsy

      52




      52




      marked as duplicate by Mark Meyer javascript
      Users with the  javascript badge can single-handedly close javascript questions as duplicates and reopen them as needed.

      StackExchange.ready(function() {
      if (StackExchange.options.isMobile) return;

      $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
      var $hover = $(this).addClass('hover-bound'),
      $msg = $hover.siblings('.dupe-hammer-message');

      $hover.hover(
      function() {
      $hover.showInfoMessage('', {
      messageElement: $msg.clone().show(),
      transient: false,
      position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
      dismissable: false,
      relativeToBody: true
      });
      },
      function() {
      StackExchange.helpers.removeMessages();
      }
      );
      });
      });
      Nov 19 '18 at 19:19


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









      marked as duplicate by Mark Meyer javascript
      Users with the  javascript badge can single-handedly close javascript questions as duplicates and reopen them as needed.

      StackExchange.ready(function() {
      if (StackExchange.options.isMobile) return;

      $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
      var $hover = $(this).addClass('hover-bound'),
      $msg = $hover.siblings('.dupe-hammer-message');

      $hover.hover(
      function() {
      $hover.showInfoMessage('', {
      messageElement: $msg.clone().show(),
      transient: false,
      position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
      dismissable: false,
      relativeToBody: true
      });
      },
      function() {
      StackExchange.helpers.removeMessages();
      }
      );
      });
      });
      Nov 19 '18 at 19:19


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


























          1 Answer
          1






          active

          oldest

          votes


















          0














          The spec is a good place to turn for this kind of subtlety. isNaN tries to convert its argument to a number; Number.isNaN doesn't, it returns false if the type of its argument isn't "number". So:






          console.log(isNaN("%"));        // true, coerced to number and result was NaN
          console.log(Number.isNaN("%")); // false, not coerced








          share|improve this answer






























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            The spec is a good place to turn for this kind of subtlety. isNaN tries to convert its argument to a number; Number.isNaN doesn't, it returns false if the type of its argument isn't "number". So:






            console.log(isNaN("%"));        // true, coerced to number and result was NaN
            console.log(Number.isNaN("%")); // false, not coerced








            share|improve this answer




























              0














              The spec is a good place to turn for this kind of subtlety. isNaN tries to convert its argument to a number; Number.isNaN doesn't, it returns false if the type of its argument isn't "number". So:






              console.log(isNaN("%"));        // true, coerced to number and result was NaN
              console.log(Number.isNaN("%")); // false, not coerced








              share|improve this answer


























                0












                0








                0







                The spec is a good place to turn for this kind of subtlety. isNaN tries to convert its argument to a number; Number.isNaN doesn't, it returns false if the type of its argument isn't "number". So:






                console.log(isNaN("%"));        // true, coerced to number and result was NaN
                console.log(Number.isNaN("%")); // false, not coerced








                share|improve this answer













                The spec is a good place to turn for this kind of subtlety. isNaN tries to convert its argument to a number; Number.isNaN doesn't, it returns false if the type of its argument isn't "number". So:






                console.log(isNaN("%"));        // true, coerced to number and result was NaN
                console.log(Number.isNaN("%")); // false, not coerced








                console.log(isNaN("%"));        // true, coerced to number and result was NaN
                console.log(Number.isNaN("%")); // false, not coerced





                console.log(isNaN("%"));        // true, coerced to number and result was NaN
                console.log(Number.isNaN("%")); // false, not coerced






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 19 '18 at 19:18









                T.J. CrowderT.J. Crowder

                687k12112221315




                687k12112221315

















                    這個網誌中的熱門文章

                    Tangent Lines Diagram Along Smooth Curve

                    Yusuf al-Mu'taman ibn Hud

                    Zucchini