DEV Community

Find Numbers with Even Number of Digits from leetcode

Manvir on November 01, 2020

Code flow as follows: -> I have converted numbers into a string. -> then find the length of the string -> If any ...
Collapse
 
vishalraj82 profile image
Vishal Raj
var findNumbers = nums => nums.reduce((acc, n) => {
  if (String(n).length % 2 === 0) { acc.push(n); }
  return acc;
}, []);
Enter fullscreen mode Exit fullscreen mode