JSFiddle - React, Tailwind, and code Playground

by hescano

JavaScript

function tripledouble(num1, num2) {
  var m = num1.toString().match(/(\d)\1{2}/g);
  var m2 = num2.toString().match(/(\d)\1{1}/g);
  return m && m2 && m.filter((a) => m2.indexOf(a.substr(1, 2)) > -1).length > 0 ? 1 : 0;
}

alert(tripledouble(666789, 12345667))