Skip to content

Commit

Permalink
day 162
Browse files Browse the repository at this point in the history
  • Loading branch information
jwardoin committed Sep 3, 2022
1 parent 166ddb1 commit 6c26da0
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions mostDigits.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Find the number with the most digits.

// If two numbers in the argument array have the same number of digits, return the first one in the array.

// my original solution

function findLongest(array) {
return array.reduce((a, b) => (`${a}`.length < `${b}`.length ? b : a), 0);
}

// what I learned from others' solutions

0 comments on commit 6c26da0

Please sign in to comment.