skip to Main Content

I’m new to javascript. I want to perform an arithmetic calculation between two javascript values as follows.
In here "issues" and "re" contains numeric values. Then I want to deduct "re" from "issues" and assign the outed value to "#bal".

Tried

$('#bal').text(jData.data.issues - jData.data.re);

Output

outs ‘0’

What may be going wrong with me ? Ca anyone help me ?

2

Answers


  1. if ‘issues’ or ‘re’ are not a number, JavaScript can’t do arithmetic calculation
    try this code:

    $('#bal').text(Number(jData.data.issues) - Number(jData.data.re));
    

    otherwise, the value of each is incorrect.

    Login or Signup to reply.
  2. check your type of issues and re,if they are String or else,
    they can not go on

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search