Skip to content
Justice Tech School

Higher Order Functions

map, where, reduce, fold and any take functions.

Example
var n = [5, 2, 8, 1];
print(n.map((x) => x * 2).toList());
print(n.where((x) => x > 2).toList());
print(n.reduce((a, b) => a + b));
print(n.fold(10, (a, b) => a + b));
print(n.any((x) => x > 7));

Exercise

Filter.

n.((x) => x > 2)

Quiz Test

What does map return?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.