Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8403297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:18:23+00:00 2026-06-09T22:18:23+00:00

I keep getting $NaN instead of a number. (Code starts on line 155 .)

  • 0

I keep getting $NaN instead of a number. (Code starts on line 155.) How can I get a number output instead of $NaN.Is there a better way to debug this to determine what exactly is being returned?

function daysInMonth(y, m) {
  var t = new Date(y, m, 0);
  return t.getDate();
}
function daysLeftInQuater(d) {
  d = d || new Date(); // If no date supplied, use today
  var t = new Date(d); // Don't mess up supplied date if there was one
  var daysLeft = 2 - (t.getMonth() % 3);

  do {
    daysLeft += daysInMonth(t.getFullYear(), t.getMonth() + 1) - t.getDate();
    t.setMonth(t.getMonth() + 1);
    t.setDate(1);
  } while (t.getMonth() % 3)

  return daysLeft;      
}
function getQuarter(d) {
  d = d || new Date();
  var m = Math.floor(d.getMonth()/3) + 2;
  return m > 4? m - 5 : m;
}
function hoa_letsgo(){
var amt_due = $("#user_ad").val();
var qma_val = $("#qma_select").val();
if (qma_val == 1){//Q
var cur_year = $("#year").val(); var cur_day = $("#day").val();
var cur_month = $("#month").val(); var now = new Date(cur_month, cur_day, cur_year);
var days_left = daysLeftInQuater(cur_month);
var ind_amt = amt_due / 4;
var day_amt = amt_due / 360;
var quarter = getQuarter(now);
var am_cred = ind_amt * quarter;
var final_cred = am_cred + (day_amt * days_left);
final_cred = final_cred - amt_due;
final_cred = final_cred.toFixed(2)
$("#credit").html("$" + addCommas(final_cred));
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T22:18:24+00:00Added an answer on June 9, 2026 at 10:18 pm

    pulling a value out of a textbox gives you a string. you cannot perform some arithmetic functions with strings because the operator is overloaded to perform a different operation. for example, the addition operator + will perform string concatenation if either operand is a string.

    wrap all of your .val() calls with a parseInt(..., 10); or parseFloat(..., 10); and it should fix your issue.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I keep getting this NPE in my application and I can't seem to get
I keep getting an error saying that @android:style/Widget.Holo.Light.Button.Borderless is not public and so can't
I keep getting this stored procedure error (wrong number or types of the arguments)
I keep getting the following error: * #1005 - Can't create table 'classorganizer.turma' (errno:
I keep getting E_INVALIDARG when calling RenderStream(). My program output is: SUCCESS - Initialized
I keep getting this whenever I run the below code: Fatal error: Call to
I keep getting Line 43: public override void Execute() { Line 44: WriteLiteral(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ +
I keep getting else without if. Any ideas why? Thanks all. By the way
I keep getting this error from my code and I have no idea what
I keep getting bad pointers. Can anyone tell me what am I doing wrong?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.