Created
October 16, 2019 20:21
-
-
Save jerolan/107a6e2192e669f8f669d273b97d6805 to your computer and use it in GitHub Desktop.
Revisions
-
jerolan created this gist
Oct 16, 2019 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ function largestPair(num) { let pair = null; num .toString() .split("") .forEach((val, index, arr) => { if (arr.length - 1 !== index) { let currentPair = parseInt(val + arr[index + 1]); if (pair < currentPair) pair = currentPair; } }); return pair; }