I have a JS array like this.
const PaymentMethods = [
    {
      type: "DEBIT",
      cardType: "VISA",
    },
    {
      type: "CREDIT",
      cardType: "VISA",
    }
  ];
As you can see, I am hardcoding these right now. But I want to dynamically update this PaymentMethods
For e.g. There will be 2 checkbox. isCredit and isDebit
- If 
isCredit = trueandisDebit = false, I want thePaymentMethodsto look like this 
const PaymentMethods = [
    {
      type: "CREDIT",
      cardType: "VISA",
    }
  ];
- If 
isCredit = falseandisDebit = true, ourPaymentMethodsshould be 
const PaymentMethods = [
    {
      type: "DEBIT",
      cardType: "VISA",
    },
  ];
- If 
isCredit = falseandisDebit = false, ourPaymentMethodsshould be 
const PaymentMethods = [];
- If 
isCredit = trueandisDebit = true, ourPaymentMethodsshould be like original one at top. 
Can someone please highlight me how I can do this. I have searched quite a few but didn't find anything in this regard yet.
PaymentMethods.push({ type: "CREDIT", cardType: "VISA", })developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/…constrather than alet. Constants are not intended to changelet