It returns the elements of an array if the condition is confirmed:

Example:How to check salaries above 1 million

const employees = [{
name: 'Jane Doe',
salary: 90000,
}, {
name: 'Donald Jones',
salary: 65000,
}, {
name: 'Donna Appleseed',
salary: 1500000,
}, {
name: 'John Smith',
salary: 250000,
}];
const makesMoreThanOneMillion = (employee) =>
employee.salary > 1000000
const result = employees.some(makesMoreThanOneMillion);
console.log(`some results:${result}`);
const formValues = [
'Shaun',
'Wassell',
'Maine',
'developer',
];
const isNotEmpty = (string) => !!string;
const allFieldsFilled = formValues.every(isNotEmpty);
console.log(allFieldsFilled);
some results:true
true
  • some  will return true if any predicate is  true
  • every  will return true if all predicate is  true

Where predicate means function that returns  bool  ( true/false) for each element

every  returns on first  false .
some  returns on first  true

Sources: https://www.linkedin.com/learning/learning-functional-programming-with-javascript-es6-plus/