0

I need to show a combination of number, how to achieve this in JavaScript

example

input:

123

Output(n*(n-1) combinations)
123
132
213
231
321
312

the given number is anything, how to achieve in short way?

Alex K.
  • 171,639
  • 30
  • 264
  • 288
Akbar Basha
  • 1,168
  • 1
  • 16
  • 38
  • 2
    Technically, what you're looking for is [permutations](http://stackoverflow.com/questions/9960908/permutations-in-javascript) instead of [combinations](http://codereview.stackexchange.com/questions/7001/generating-all-combinations-of-an-array) – Stryner Jul 29 '15 at 16:49
  • Have you tried converting that formula into javascript? – Andrew Jul 29 '15 at 16:50

0 Answers0