Snippet format update
To match the starter (for the migration)
This commit is contained in:
@ -1,4 +1,7 @@
|
||||
### luhnCheck
|
||||
---
|
||||
title: luhnCheck
|
||||
tags: math,utility,advanced
|
||||
---
|
||||
|
||||
Implementation of the [Luhn Algorithm](https://en.wikipedia.org/wiki/Luhn_algorithm) used to validate a variety of identification numbers, such as credit card numbers, IMEI numbers, National Provider Identifier numbers etc.
|
||||
|
||||
@ -7,7 +10,6 @@ Use `Array.prototype.splice(0,1)` to obtain the last digit.
|
||||
Use `Array.prototype.reduce()` to implement the Luhn Algorithm.
|
||||
Return `true` if `sum` is divisible by `10`, `false` otherwise.
|
||||
|
||||
|
||||
```js
|
||||
const luhnCheck = num => {
|
||||
let arr = (num + '')
|
||||
@ -25,4 +27,4 @@ const luhnCheck = num => {
|
||||
luhnCheck('4485275742308327'); // true
|
||||
luhnCheck(6011329933655299); // false
|
||||
luhnCheck(123456789); // false
|
||||
```
|
||||
```
|
||||
Reference in New Issue
Block a user