Simple surcharge algorithm could use DRY I solved this exercise on jshero.com but I know the solution can be written more cleanly, I just don't know how.
Here are the directions:
Write a function addWithSurcharge that adds two amounts with surcharge. For each amount less than or equal to 10, the surcharge is 1. For each amount greater than 10 and less than or equal to 20, the surcharge is 2. For each amount greater than 20, the surcharge is 3.
This challenge also supposes that you use if...else if...else to solve the exercise. The course also hasn't touched on functions within functions, so I'm mainly concerned with simplification and readability, but also curious about ternaries. Here is my attempt which works,
function addWithSurcharge(num1, num2) {
    let surcharge = 0;
    if (num1 &lt;= 10) {
        surcharge += 1;
    } else if (num1 &gt; 10 &amp;&amp; num1 &lt;= 20) {
        surcharge += 2;
    } else {
        surcharge += 3;
    }
    
    if (num2 &lt;= 10) {
        surcharge += 1;
    } else if (num2 &gt; 10 &amp;&amp; num2 &lt;= 20) {
        surcharge += 2;
    } else {
        surcharge += 3;
    }
    
    return surcharge + num1 + num2;
}

Thank you, much appreciated!
From a short review;

You are dealing with amounts, but you call your variable num1 and num2
Your code now has tons of magic numbers, you should use named constants
I understand you are not yet in to 'functions within functions', but that is how you apply DRY in this case

So the DRY version could look like this;
function addSurcharge(amount){
  const FLOOR = 10;
  const CEILING = 20;

  if (amount &lt;= FLOOR) {
    return amount + 1;
  } else if (amount&lt;= CEILING) {
    return amount + 2;
  } else {
    return amount + 3;
  }    
}

function addWithSurcharge(amount1, amount2) {
  return addSurcharge(amount1) + addSurcharge(amount2);
}