Useful and clear example Aphinya!

I think your functional filter example could be shortened to the following even--

let neuteredAnimals = animals.filter((a) => { return a.isNeutered; });

let neuteredAnimals = animals.filter((a) => a.isNeutered );

Source: https://stackoverflow.com/a/32040486

Written by

πŸ€“ The physical therapist who writes JavaScript πŸ’ͺ Web Developer 😎 Mentor 🧠 DPT πŸ˜„ SEO Expert 😁 React πŸ˜† Jamstack πŸ—―οΈ Ask me anything πŸ‘‰ DoctorDerek.com πŸ‘ˆ

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store