比如有这样一个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} ]
实现的功能是,枚举一下所有的组合,比如n=3,就表示从中选择3个,组成一组,所有的都列举出来。
但是id相同的不能列为一组,
n=3
{"name":"热烈","id":1},{"name":"万分","id":2},{"name":"非常","id":3},这是正确的
{"name":"热烈","id":1},{"name":"万分","id":2},{"name":"欢迎","id":1}这是错误的
MYYA
慕的地6264312
相关分类