const employees = [{
  name: 'John Olsen',
  age: 54,
  jobTitle: 'developer',
  salary: 70000,
}, {
  name: 'Karen Norris',
  age: 34,
  jobTitle: 'engineer',
  salary: 75000,
}, {
  name: 'Daryl Cline',
  age: 25,
  jobTitle: 'secretary',
  salary: 54000,
}, {
  name: 'Abbey Garcia',
  age: 40,
  jobTitle: 'developer',
  salary: 100000,
}, {
  name: 'Finn Smith',
  age: 29,
  jobTitle: 'engineer',
  salary: 40000,
}, {
  name: 'Eve Wordsworth',
  age: 20,
  jobTitle: 'developer',
  salary: 65000,
}, {
  name: 'Ronald Jacobs',
  age: 60,
  jobTitle: 'developer',
  salary: 90000,
}];

const developers = employees.filter((employee) => 
employee.jobTitle === 'developer');
const developerSalaries = developers.map((developer) => 
developer.salary);
console.log('developerSalaries: ' +developerSalaries);

const totalDeveloperSalaries = 
developerSalaries.reduce((acc, x) => acc + x, 0);
console.log('totalDeveloperSalaries: '+totalDeveloperSalaries);

const averageDeveloperSalary = 
totalDeveloperSalaries / developerSalaries.length;
console.log("averageDeveloperSalary: "+averageDeveloperSalary);

const nonDevelopers = employees.filter((employee) => 
employee.jobTitle !== 'developer');
const nonDeveloperSalaries = nonDevelopers.map((nonDev) => 
nonDev.salary);
const totalNonDeveloperSalaries = 
nonDeveloperSalaries.reduce((acc, x) => acc + x, 0);
console.log('totalNonDeveloperSalaries: '+totalNonDeveloperSalaries );

const averageNonDeveloperSalary = 
totalNonDeveloperSalaries / nonDeveloperSalaries.length;
console.log("averageNonDeveloperSalary: "+averageNonDeveloperSalary);

Output:

developerSalaries: 70000,100000,65000,90000
examples.js:42
totalDeveloperSalaries: 325000
examples.js:46
averageDeveloperSalary: 81250
examples.js:50
totalNonDeveloperSalaries: 169000
examples.js:58
averageNonDeveloperSalary: 56333.333333333336