DEV Community

Discussion on: Validate a Credit Card Number with Functional JavaScript

Collapse
 
emnudge profile image
EmNudge

Protip:
You can reference the end of an array by using negative integers.
i.e.
Instead of .slice(0, len - 1) you can do .slice(0, -1)

Collapse
 
deciduously profile image
Ben Lovy

Ooh, thanks! Much nicer. JS is definitely not in my muscle memory yet.

Some comments have been hidden by the post's author - find out more