JavaScript Multiplier Script

So I’ve very recently dived into JS and i’m not quite understanding the Logical steps here i’m assuming.

My question is, So let’s say i wanted to have a multiplier that can be bought to increase food income by 2x, how would i cap it from being purchased again?

'
var gameData = {
gold: 0,
goldPerClick: 1,
goldPerClickCost: 10,
food: 0,
foodPerClick: 2,
foodUpgradeCost: 10,

}

  function x2() {
    if (gameData.foodPerClick >=2) {
      gameData.foodPerClick *= 2
    } else (gameData.foodPerClick ????)
    applied = "Used";
    document.getElementById("applied").innerHTML = applied
  }'

Answer

In gameData object keep a boolean.

var gameData = {
   //other attributes
   
   isxTwoApplied: false
}

Then when executing the x2() check if isxTwoApplied === falseand change this to true.

function x2() {
    if (!gameData.isxTwoApplied) {
       if (gameData.foodPerClick >=2) {
          gameData.foodPerClick *= 2
          gameData.isxTwoApplied = true
       } else

    //rest of the code
  }'