Why 2 parameters in sort

More specifically, why the 2 parameters in the .sort() function and why does subtracting them
sort them?

const speciesArray = 
[ {speciesName:'shark', numTeeth:50}, 
{speciesName:'dog', numTeeth:42}, 
{speciesName:'alligator', numTeeth:80}, 
{speciesName:'human', numTeeth:32}];


const sortSpeciesByTeeth = arr => arr.sort(
 (a, b) => {return a.numTeeth - b.numTeeth}
)