1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| var SCRIPTS = [ { name: 'Adlam', ranges: [[125184, 125259], [125264, 125274], [125278, 125280]], direction: 'rtl', year: 1987, living: true, link: 'https://en.wikipedia.org/wiki/Fula_alphabets#Adlam_alphabet', }, { name: 'Caucasian Albanian', ranges: [[66864, 66916], [66927, 66928]], direction: 'rtl', year: 420, living: false, link: 'https://en.wikipedia.org/wiki/Caucasian_Albanian_alphabet', }, { name: 'Ahom', ranges: [[71424, 71450], [71453, 71468], [71472, 71488]], direction: 'ltr', year: 1250, living: false, link: 'https://en.wikipedia.org/wiki/Ahom_alphabet', }, ];
function filter(array, test) { let passed = []; for (let element of array) { if (test(element)) { passed.push(element); } } return passed; }
console.log(filter(SCRIPTS, script => script.living));
|