I'm having problem with return
since node
is all asynchronous.
var myFUNC = function(A, B) {
A.every(function(AA) {
return (AA === B);
});
return true;
};
if(!myFUNC(...)) {
....
}
Of course the function always returns true
but it should not do this, as I'm starting with node
, I do not know how to solve this impasse.
It should follow the following logic:
- scans
array
A
- If
AA === B
isfalse
it stops byarray
and returnsfalse
- If no item of
array
returnsfalse
then returnstrue