-
-
Save colevandersWands/b361f6a7695188e54eb6651ec8741cbb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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