Skip to content

Instantly share code, notes, and snippets.

@JakeDuke
Created April 10, 2018 09:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save JakeDuke/50dc0f92f214ee4c52c8820a2596f5e4 to your computer and use it in GitHub Desktop.
Save JakeDuke/50dc0f92f214ee4c52c8820a2596f5e4 to your computer and use it in GitHub Desktop.
function tripledouble(num1, num2) {
var check1 = '';
var check2 = '';
if (typeof num1 !== 'number' || typeof num2 !== 'number'){
return 0;
}
var a = num1.toString().split('');
var b = num2.toString().split('');
for (var i = 0; i < a.length; i++){
if(a[i] === a[i+1] && a[i] === a[i+2]){
check1 = true;
}
for (var j = 0; j < b.length; j++){
if(b[j] === b[j+1]){
check2 = true;
}
}
}
if (check1 === true && check2 === true) {
return 1;
} else {
return 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment