Is this, javascript's combination algorithm, how to write an algorithm?

for example, there is such an object:

var wordList=[
{"name":"","id":1},{"name":"","id":2},{"name":"","id":3},
{"name":"","id":1},{"name":"","id":2},{"name":"","id":3},
{"name":"","id":2},{"name":"","id":1},{"name":"","id"1}
]

sources of topics and their own ideas

The function of

is to enumerate all the combinations, such as nasty 3, which means to select three of them to form a group, and all of them are enumerated.

what result do you expect? What is the error message actually seen?

but those with the same id cannot be grouped together,
nasty 3
{"name": "warm", "id": 1}, {"name": "extremely", "id": 2}, {"name": "very", "id": 3}, this is correct
{"name": "warm", "id": 1}, {"name": "ten thousand", "id": 2}, {"name": welcome,

Mar.28,2021

consider dividing it into several arrays according to id, and then taking them out from each array to combine them.


look at the wordList, you set now. If n is greater than 3, you cannot extract enough elements from the array (otherwise there must be duplicates). What effect do you need at this time? Please describe it clearly.

Menu