New course! Every coder should learn Generative AI!
Try a free lesson+ 1
What is the difference between filter() and takewhile()?
1 Answer
+ 10
filter() gets ALL items of the list that match the predicate whereas takewhile() gets all items until an element occurs that doesn't match the predicate