Array Methods! Pt.3 (some, every)

A continuation from my previous blog post, we’ve made it to the third one! My thought process of breaking my blogs up was for people to take a quick read or refresher. I believe that is the best way to learn something thats either new or something you’ve once learned before, rather than going through a long tedious blog of mine! All jokes aside I cut these arrays into certain blogs for easier access as well.

Something that I haven’t used often at all is the some method. The some method tests at the very least one element in the array that passes the test implemented by the provided function. It returns true if in the array, it finds an element for which the provided function returns true, if false, the method will not modify the array. This was defined by MDN Web Docs, my interpretation of the some method is that the some has to figure out an element and then give a result as a boolean if true. If it returns false, then the array would not be modified. Complicated way to describe it, but ill show an example now:

some method

Now for the every method, this is also another one I haven’t used much just yet. The every method is defined by MDN Web Docs as a method that tests wether all elements in the array pass the test implemented by the provided function. It returns a Boolean value. Somewhat self explanatory, but what I take from it, is that the method tests the function and will return a boolean being true or false depending on the outcome of the result.

Presenting you two of the least used in my own code was somewhat of a challenge for me to explain. I do hope you found it helpful and start using it in your everyday code! I will be trying to do the same! Always remember practice makes somewhat perfect and that everyday is a new day to learn something new! Thank you for taking the time to read this short blog!

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Developers have lost their jobs or have they?

Presentation Recap: The Distributed Database Behind Twitter

Google Config Connector: Deploying Spanner from Kubernetes

Remote access to IoT devices using Azure IoT Hub — Device Streams

Your new API backend for the Jamstack

Full stack development Skills and Knowledge Required

Introduce Eloquent Filter 2 in Laravel

Klaviyo Email Automations Tutorial for Beginners

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
David Lago

David Lago

More from Medium

Day 66/100 JavaScript and the Browser

JavaScript Removing the Escape Character

My Coding Journey

laptop with brightly colored computer language on its screen sitting on a table

Things you need to know about JavaScript Callback Functions