const minN = (arr: Array<number>, n: number = 1) => [...arr].sort((a, b) => a - b).slice(0, n);
      

      Typescript language logo
      Min elements array

      Codiga's TypeScript Recipes

      Returns the n minimum elements from the provided array.

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.