Get immediate access to this and over 1,500+ other videos and books.

Boost your skills with a Beginner subscription. With over 60+ video courses and our core foundational programming books bundled in one subscription, it’s simply the best investment you can make in your development career.

Challenge: Write an Anonymous Method

This video was last updated on Jun 21 2022

In this first challenge of the part, you’ll put your knowledge of anonymous methods to the test by filtering out a list.


Heads up... You've reached locked video content where the transcript will be shown as obfuscated text.

You can unlock the rest of this video course, and our entire catalogue of books and videos, with a Professional subscription.

By now, you should feel comfortable writing anonymous methods so why not practice with a challenge? In your challenge, I want you to create a list of scores of forty three, eighty six, ninety nine, and three. Put those scores in a list.

  var numbers = [43, 86, 99, 3];
var even = numbers.firstWhere();
var even = numbers.firstWhere((item) {

var even = numbers.firstWhere((item) {
    if (item % 2 == 0) {
        return true;
    } else {
        return false;
var even = numbers.firstWhere((item) {
    return (item % 2 == 0);
var even = numbers.firstWhere((item) => item % 2 == 0);