Second stimulus payment calculator

The second stimulus payment for US residents was signed yesterday. I read a bunch of articles online to figure out how much I would receive, but found them rather confusing.

I ended up writing my own calculator. It looks ugly, but it's simple and it works. Here's how it works (full code and the code in action are below):
Lines [1-18] are the HTML page: [4-11] a form for the 'filing status' with three radio buttons
[12] a text input for the income
[14] a text input for the number of dependents
I decided to use text inputs because I didn't like the arrows on standard 'number' inputs
[17] a label to display the result
[18] a button to re-trigger the calculation

[19-42] is the JavaScript part:
[20-23] Assign the HTML DOM elements to the JS variables
[24-41] The main (and only) function that does the calculation:
[25-31] Find which radio button is checked
[32] Headcount of taxpayers eligible based on the filing status (2 for married, 1 otherwise)
[33] The dollar limits corresponding to the filing status.
If your income is above these limits, your payment will be reduced.
[34-35] convert user input to number. This takes care of situations where the input is blank or contains a letter by mistake.
[36] The initial estimate assumes $600 per taxpayer plus $600 per dependent.
[37] calculate the amount by which the income exceeded the limit
[38] calculate the reduction amount ($5 reduction per $100 of amountOverLimit)
[39] The final estimate = estimate - reduction (or zero, whichever is greater)
[40] display the estimate

Select your filing status:<br>
<input type="radioname="filingStatusvalue=0 checked="true">
<input type="radioname="filingStatusvalue=1>
<input type="radioname="filingStatusvalue=2>
head of household<br>
Enter your 2019 income here: <input type="textid="incomeInput">
Enter the number of your dependents below the age of 17 here: <input type="textid="dependentsInput">
<label id="estimateLabel"></label><br>
<button id="recalculateButton">Click here to recalculate</button>
const incomeInput = document.getElementById('incomeInput');
const dependentsInput = document.getElementById('dependentsInput');
const estimateLabel = document.getElementById('estimateLabel');
const recalculateButton = document.getElementById('recalculateButton');
recalculateButton.onclick = function() {
  let selectedValue = 0;
  const radioButtons = document.querySelectorAll('input[name="filingStatus"]');
  for (const radioButton of radioButtons) {
    if (radioButton.checked) {
      selectedValue = radioButton.value;
  const headcount = [121];
  const limit = [75000150000112500];
  let income = Number(incomeInput.value);
  let dependents = Number(dependentsInput.value);
  let estimate = 600 * (headcount[selectedValue] + dependents);
  let amountOverLimit = Math.max(0income - limit[selectedValue]);
  let reductionAmount = amountOverLimit * .05;
  let finalEstimate = Math.max(0estimate - reductionAmount);
  estimateLabel.innerText = "You are likely to receive: " + finalEstimate;

And finally this is how it actually works.

For income, enter your AGI (Adjusted Gross Income - from field 8b of your last form 1040), without commas.

Select your filing status:
head of household
Enter your 2019 income here:
Enter the number of your dependents below the age of 17 here:

Check out these programming tutorials:


Optical illusion (18 lines)

Spinning squares - visual effect (25 lines)

Oldschool fire effect (20 lines)

Fireworks (60 lines)

Animated fractal (32 lines)

Physics engine for beginners

Physics engine - interactive sandbox

Physics engine - silly contraption

Starfield (21 lines)

Yin Yang with a twist (4 circles and 20 lines)

Tile map editor (70 lines)

Sine scroller (30 lines)

Interactive animated sprites

Image transition effect (16 lines)

Your first program in JavaScript: you need 5 minutes and a notepad

Fractals in Excel

Python in Blender 3d:

Domino effect (10 lines)

Wrecking ball effect (14 lines)

3d fractal in Blender Python