Since these methods return a boolean, I would suggest a better way of naming the variables that holds the return values of those methods so that we understand quickly what values these variables are holding and why they are being used in the source-code.
// It reads almost as plain english and this comment is uselessconstsomeoneIsLawyer=persons.some(({occupation})=>{returnoccupation==="Lawyer";});
Because I have an easier time reading this code.
// Reads as plain english againif(someoneIsLawyer){console.log("Do something if there is a lawyer.");}
Than this one.
// What does it hold? A boolean? Is it a function?if(lawyerCheck){console.log("Do something if there is a lawyer.");}
Since these methods return a boolean, I would suggest a better way of naming the variables that holds the return values of those methods so that we understand quickly what values these variables are holding and why they are being used in the source-code.
Because I have an easier time reading this code.
Than this one.
Thanks for this comment. I will definitely incorporate this next time around. :)
Definitely makes sense. Boolean variables should has prefixes such as 'has, is' etc. in my opinion.