Currently learning JS ES6+ syntax and am doing an exercise on finding the average salary of developers vs average salary of non-developers. The code is working but from my understanding, clean code is having a function doing only 1 task.Currently, averagePay has 3 tasks.

Is there a way to feed these 3 tasks as unnamed functions into averagePay using arrow method, keeping them all wrapped inside one single averagePay. I do not wish to create too many functions on the outside.

Apologies if I am using the wrong terms or causing even more confusion.
Am still learning Higher Order Functions and trying to wrap my head around multiple layers of functions within function within functions.

Thank you for your kind help.

```js
const datasetEmployee = [
    {
        name: 'Person1',
        job: 'developer',
        salary: 1000
    },
    {
        name: 'Person2',
        job: 'developer',
        salary: 2000
    },
    {
        name: 'Person3',
        job: 'Job3',
        salary: 3000
    }
];

const averagePay = (dataFiltered) => {

    const filteredSalary = dataFiltered.map( (each) => each.salary);
    const sumSalary = filteredSalary.reduce((acc,curr) => acc+curr, 0);
    return sumSalary/filteredSalary.length;
}

const isDev = datasetEmployee.filter( (each) => each.job === 'developer');
const isNotDev = datasetEmployee.filter( (each) => each.job !== 'developer');

console.log(averagePay(isDev));
console.log(averagePay(isNotDev));
```

strong text