0

It's my first question here!) Why this function return 'undefined'? Thanks

const arr = [1, 1, 2, 1, 2, 1]
selector = function (arr) {
    let counter = 0;
    arr.forEach(element => {
        if (element == 2) {
            counter += 1;
        }    
    });
}
Barmar
  • 741,623
  • 53
  • 500
  • 612

0 Answers0