DEV Community

Discussion on: Solving "Where do I Belong" / freeCodeCamp Algorithm Challenges

Collapse
ttatsf profile image
tatsuo fukuchi

Another way:

const getIndexToIns = (arr, num) => 
  arr
  .sort((a, b) => a - b)
  .filter(e => e < num)
  .length
Enter fullscreen mode Exit fullscreen mode