[英]Obtain all possible combinations of the elements of an array with each other, in pairs and without repeating
[英]All possible combinations of an array without repeating?
說我有和數組:
var arr = [1,2,3,4];
我將如何重復獲取所有可能的組合?
例如:
// "2,1" wouldn't be valid because it's essentially "1,2"
1
1,2
1,2,3
1,2,3,4
2
2,3
2,3,4
3
3,4
4
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.