DEV Community

loading...

Discussion on: Daily Challenge #18 - Triple Trouble

Collapse
aoneill01 profile image
Andy O'Neill

Seems like a good problem for regex with backreferences. JavaScript:

function tripledouble(num1, num2) {
    return /(\d)\1\1.*,.*\1\1/.test(`${num1},${num2}`) ? 1 : 0;
}