Skip to content

Instantly share code, notes, and snippets.

@colevandersWands
Forked from JakeDuke/Buggy code.js
Last active April 10, 2018 09:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save colevandersWands/b361f6a7695188e54eb6651ec8741cbb to your computer and use it in GitHub Desktop.
Save colevandersWands/b361f6a7695188e54eb6651ec8741cbb 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