Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

subset in js

// This was posted by programmer rimon on 2022-02-10; youtube.com/programmerrimon
var list = [[]];
var numbers = [2,3,6,4];
for(let v of numbers) {
    const l = list.length;
    for(let i=0;i<l;++i) {
        let t = list[i].slice(0);
        t.push(v);
        list.push(t);  
    }
}
 
PREVIOUS NEXT
Tagged: #subset #js
ADD COMMENT
Topic
Name
3+4 =