JSFiddle - React, Tailwind, and code Playground
by asemahle
HTML
<script src="https://cdn.jsdelivr.net/npm/[email protected]/combinatorics.min.js"></script>
JavaScript
console.log('hello');
let all = Combinatorics.permutation(
['0','1','2','3','4','5','6','7','8','9'],
4
).toArray();
console.log(all);
let f = all.filter(e => {
e = e.join('');
console.log(e);
return !e.startsWith('0') && (
e.endsWith('1') ||
e.endsWith('3') ||
e.endsWith('5') ||
e.endsWith('7') ||
e.endsWith('9'))
})
console.log(f);