Created
April 10, 2018 09:16
-
-
Save JakeDuke/50dc0f92f214ee4c52c8820a2596f5e4 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