In this JavaScript tutorial, we look at, Iterators Explained, The filter method with JavaScript, Codecademy's Use the filter Method on Arrays. We take a look at the lesson, "The .filter() method" on Codecademy's Learn JavaScript course. We learn that like the .map() method, the .filter() method returns a new array. We are also taught in this JavaScript lesson that .filter() method will filter out certain elements in our array based on whether or not the callback function returns true or false. Any elements that cause our callback function to return a true result will be added to the array, while any false values will not be added to the new array. Giving our callback function a condition is the way we decide what element our new array should keep when using the .filter() method on an array. We see 2 examples of how we might use the .filter() method. The first example takes a list of numbers, and creates a new variable that looks at the list of numbers, and returns numbers below a certain number. This would help us gather certain numbers that meet a specific condition. We also learn how to take an array with words and return only words that are a certain length depending on the condition we create. Using the filter() method is important in becoming a master programmer. Learn .filter() as well as other iterator methods to master programming!
Auf dieser Seite können Sie das Online-Video Iterators Explained, The filter method with JavaScript, Codecademy's Use the filter Method on Arrays mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer We Will Code 15 März 2022 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 223 Mal angesehen und es wurde von 7 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!