'Subtracting from a variable

I have code setup so that a player clicks an image which gets counted and if they have more than 30 it will allow them to buy an auto clicker for 30 clicks which then subtracts 30 clicks and sets c1 or your first buy option to 1 so you can only purchase 1 auto clicker, but every time I include: clicks - 30 it does not display the counter. (Also there is an ending bracket for updateClickCount it is just not shown)

var clicks = 0;
function updateClickCount() {
  document.getElementById("clickCount").innerHTML = clicks;

  var c1 = 0;
  if (clicks > 5 && clicks < 10) {
    document.getElementById("over").innerHTML = "Good Job!";
  } else {
    document.getElementById("over").innerHTML = "";
  }

  function buyClicker() {
    if (clicks > 30 && c1 == 0) {
      clicks - 30
      c1 = 1
    }


Solution 1:[1]

You aren't assigning clicks - 30 to anything. It should be clicks -= 30. Also your code is breaking because you are missing semi colons after both lines in buyClicker.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Alden Be