Nice work! Your comments made this code really easy to understand and read through. Really nice work using methods such as .split and .reduce. Really creative stuff. A few comments: I'm not sure if this would help you as well, but for me I found I was able to substantially refactor my code by taking the initial number that was passed in, and storing it in an array of digits (just a thought; it may not be as helpful for you). Secondly, I noticed that your last line in the check_card method is the following:
credit_card_summed % 10 == 0 ? true : false
you could refactor your code further by changing that line to:
credit_card_summed % 10 == 0
Since that expression itself will evaluate to either true or false. Nice work overall!
Hi Kevin,
Nice work! Your comments made this code really easy to understand and read through. Really nice work using methods such as .split and .reduce. Really creative stuff. A few comments: I'm not sure if this would help you as well, but for me I found I was able to substantially refactor my code by taking the initial number that was passed in, and storing it in an array of digits (just a thought; it may not be as helpful for you). Secondly, I noticed that your last line in the check_card method is the following:
credit_card_summed % 10 == 0 ? true : false
you could refactor your code further by changing that line to:
credit_card_summed % 10 == 0
Since that expression itself will evaluate to either true or false. Nice work overall!
Spencer