Pages

Projet

Ecrire l'équivalent Js de ce code Python


  1. import random
  2. from collections import Counter

  3. l = [random.randint(0,9) for i in range(10)]

  4. print (l)

  5. print(Counter(l).most_common())

  6. print(Counter(l).most_common(1))


Exemple de résultat
[6, 6, 0, 4, 8, 7, 6, 4, 7, 5]
[(6, 3), (4, 2), (7, 2), (0, 1), (8, 1), (5, 1)]
[(6, 3)]

code