NaN in the value of a variable, what to do?

  • 0
    Help please, when creating a web page, there was a problem: in short: I declared a variable, a function for a button with output and change of a variable, everything worked, for convenience I created a folder and all the scripts there, attached them, click on the button, and where the variable should be writes NaN.
    If there is little information, then here is a site with a project (a project to create a new pseudo-cryptocurrency, I want to put it in VK as a mini application): like a site
    JavaScript Anonymous, Sep 11, 2020

  • 2 Answers
  • 0
    Initialize the variable:

    var money = 0;
    Anonymous

  • 0
    You just have var money; that is, you have not assigned a value. You need to make zero immediately:

    var money = 0;
    Anonymous

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!