Array.prototype.filterbeginnerconst words = ['hi', 'hello', 'hey', 'howdy']
words.filter(w => w.length > 3) // β ['hello', 'howdy']Use filter() to keep only strings that meet a length or pattern requirement.
filter() can be used on any array type. Filtering strings by their length is a common pattern for text processing.
Challenge: Implement filterLong(strs, minLen) that returns only strings with length >= minLen.
filterLong(['hi', 'hello', 'world', 'ok'], 4) // β ['hello', 'world']
filterLong(['a', 'bb', 'ccc'], 2) // β ['bb', 'ccc']