Two Lines Only

```javascript []
const perform = ([a, ...b]) => b.map((x) => ([a, x] = [x, a], (+x + +a) % 10));
const hasSameDigits = f = s => s.length < 3 ? s[0] === s[1] : f(perform(s));

```
['JavaScript']