JAVASCRIPT - Where is the array mutation happening?!?
Go to solution
Solved by 0x21,
// Add your functions below: const validateCred = arr => { ... doubleDigit = arr[i] *= 2; ... } const findInvalidCards = batchArr => { ... invalidCards.push(invalid1); ... } //console.log(findInvalidCards(batch)); console.log(findInvalidCards(batch));
You are using multiplication assignment, where I think you just want multiplication.
Also, you are always pushing `invalid1` to your `invalidCards` array, as opposed to the specific card you are validating for that iteration.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now