You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.4 KiB

## Using Filter
### Instructions
- Create a function `filterShortStateName` that takes an array of
strings and that returns the ones with less than 7 characters.
> Example: `'Iowa'` only contains 4 characters
- Create a function `filterStartVowel` that takes an array of strings
and that returns only the ones that start with a vowel (a,e,i,o,u).
> Example: `'Alabama'` starts with a vowel
- Create a function `filter5Vowels` that takes an array of strings
and that returns only the ones which contain at least 5
vowels (a,e,i,o,u).
> Example: `'California'` contains at least 5 vowels
- Create a function `filter1DistinctVowel` that takes an array of
strings and that returns only the ones which vowels are of only
one distinct one (a,e,i,o,u).
> Example: `'Alabama'` only contains 1 distinct vowels `'a'`.
- Create a function `multiFilter` that takes an array of
objects and that returns only the ones which:
- the key `capital` contains at least 8 characters.
- the key `name` does not start with a vowel
- the key `tag` has at least one vowel.
- the key `region` is not `'South'`
Example of an array of objects matching the criterias:
[
{ tag: 'CA', name: 'California', capital: 'Sacramento', region: 'West' },
{ tag: 'PA', name: 'Pennsylvania', capital: 'Harrisburg', region: 'Northeast' }
]
### Notions
- https://devdocs.io/javascript/global_objects/array/filter