creditCheck.js
//function that ids the company associate with invalid cards in invalidCard array
function that ids the company associate with invalid cards in invalidCard array
function that ids the company associate with invalid cards in invalidCard array
function idInvalidCardCompanies(invalidCards) {
    const companies = [];
    for (let i = 0; i < invalidCards.length; i++) {
      switch (invalidCards[i][0]) {
        case 3:
          if (companies.indexOf("Amex") === -1) {
            companies.push("Amex");
          }
          break;
        case 4:
          if (companies.indexOf("Visa") === -1) {
            companies.push("Visa");
          }
          break;
        case 5:
          if (companies.indexOf("Mastercard") === -1) {
            companies.push("Mastercard");
          }
          break;
        case 6:
          if (companies.indexOf("Discover") === -1) {
            companies.push("Discover");
          }
          break;
        default:
          console.log("Company not found");
      }
    }
    return companies;
  }
function idInvalidCardCompanies ( invalidCards ) { const companies = [ ] ; for ( let i = 0 ; i < invalidCards . length ; i ++ ) { switch ( invalidCards [ i ] [ 0 ] ) { case 3 : if ( companies . indexOf ( "Amex" ) === - 1 ) { companies . push ( "Amex" ) ; } break ; case 4 : if ( companies . indexOf ( "Visa" ) === - 1 ) { companies . push ( "Visa" ) ; } break ; case 5 : if ( companies . indexOf ( "Mastercard" ) === - 1 ) { companies . push ( "Mastercard" ) ; } break ; case 6 : if ( companies . indexOf ( "Discover" ) === - 1 ) { companies . push ( "Discover" ) ; } break ; default : console . log ( "Company not found" ) ; } } return companies ; }
function that ids the company associate with invalid cards in invalidCard array
function that ids the company associate with invalid cards in invalidCard array