Skip to content

WildCodeSchool/dojo-js-combi

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Create a function that returns all combinations of a given list of elements (without repetition).

Examples

combi(['A', 'B', 'C']); // -> ['ABC', 'ACB', 'BAC', 'BCA', 'CAB', 'CBA']

combi(['A', 'B', 'C', 'A']); // -> ['ABC', 'ACB', 'BAC', 'BCA', 'CAB', 'CBA']

combi([1, 2, 3]); // -> ['123', '132', '213', '231', '312', '321']

combi([1, 'Z', 3]); // -> ['1Z3', '13Z', 'Z13', 'Z31', '31Z', '3Z1']

combi([]); // -> []

combi(); // -> Throws an Error: Illegal argument

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%