I am starting to learn Javascript and I do not understand the following:
I need to execute the method "pay" in order to pay all the different persons; so, I need to complete the function "salary". The function receives an array object; all those objects "know" how to execute the method "pay". Also, I want to store the result in the array "result".
I did this but it seems it's not working:
function salary($persons) {
  $results= [];
  $persons->pay();
  return $results;
} 
What am I missing? What's wrong with my function?
