This is the first I'm finding this, excited to play along! Here is yesterday's (edited to make the colors show up):
function stray(numbers) { let num1 = numbers[0], num2; let dupOf1 = false; for(let i=1; i<numbers.length; i++) { if(numbers[i] === num1) { if(num2) return num2; else dupOf1 = true; } else if(numbers[i] === num2) return num1; else num2 = numbers[i]; } return dupOf1 ? num2 : num1; }
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
This is the first I'm finding this, excited to play along! Here is yesterday's (edited to make the colors show up):