Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

235
Views
Expense checker (javascript program)

i need to make an expense checker, and this is the requirement in javascript: In the div with the verdict id displays the message You spent too much! if the value of the expenses exceeds 20% of Jon's total income. Otherwise you will see the message Your expenses are in the parameters.

This is html code:

<div>
    <div>Valoare alocatie: <input id="revenue"></div>
    <div>Cheltuieli totale : <input id="expenses"></div>
    <button id="check-button">Verifică</button>
    <div id="verdict"></div>
</div>

how can i solve the problem ? i tried this:

let revenue=document.getElementById('revenue');
let expenses=document.getElementById('expenses');
let btn=document.getElementById('check-button');
let verdict=document.getElementById('verdict');
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You could try this:

if(expenses > (20/100 * revenue)){
    verdict.innerText += 'You spent too much!';
} else {
    verdict.innerText += 'Your expenses are in the parameters';
}

Basically what it does is checks if the expenses are more than 20%(which can also be represented as 20/100) of revenue (* revenue) and prints out accordingly.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!