The best description to filter
function is https://developer.mozilla.org/pl/docs/Web/JavaScript/Referencje/Obiekty/Array/filter
You should simply condition function:
function conditionFun(element, index, array) {
return element >= 10;
}
filtered = [12, 5, 8, 130, 44].filter(conditionFun);
And you can't access the variable value before it is assigned