DEV Community

Discussion on: Daily Challenge #18 - Triple Trouble

Collapse
 
coreyja profile image
Corey Alexander

I'm getting caught up a few days behind, but I understood this is three digits in a row. Which I think is confirmed by the linked challenge examples.

So num1 = 8777 and num2 = 877 would return true for this!

Starting on my version now

Thread Thread
 
alvaromontoro profile image
Alvaro Montoro • Edited

To achieve that, the only change would be in the if statement. Instead of doing x*3 and x*2, it would be ''+x+x+x and ''+x+x respectively:

if (strNum1.indexOf(''+x+x+x) > -1 && strNum2.indexOf(''+x+x) > -1) {