How to work with the obj from a method callback?

I want the array.forEach to

for each of its elements, console log the entire array once, logging array.length times in total

instead of just console log each of its 10 elements.

To accomplish this, I need to have a reference to the array inside the array.forEach(callback) function:

(element)  => {
console.log(the entire array, not the element)
} );

Or this example:

const callbackMale = () => {
  let name =;
  return 'Mr. ' + name;

const callbackFemale = () => {
  let name =;
  return 'Ms. ' + name;
//I need to use the 'name' property value of the object which a method using this callback is called upon
// i need === for the callback to work

const obj 1= {
  name: 'Foo'; 

const obj2= {
  name: 'Bar'; 

obj1.methodA(callBackMale); // Mr. Foo
obj2.methodB(callBackFemale); //Ms. Bar

(OR in general, let the callback do something to/with the obj/arr the method is called upon)