pass a variable to foreach function

The way you're referencing antwoord inside haalScoresOp is invalid/nonsense/not good. You're referencing it as if it was a variable in scope… well, it's not. The function should accept it as parameter just like its other parameters:

function haalScoresOp(antwoord, item, index) {
  ..
  console.log(antwoord);
}

Then you can pass it in on the caller's side:

opleidingArray.forEach(function (item, index) {
    haalScoresOp(antwoord, item, index)
});

or:

opleidingArray.forEach(haalScoresOp.bind(null, antwoord));

You can simply use :

opleidingArray.forEach(haalScoresOp, antwoord);

And refer to antwoord inside the haalScoresOp function as follow:

function haalScoresOp(){
    var diantwoord = this.valueOf();
}

antwoord is passed as 'this' object to the function regarding the type