javascript return all array elements starting with code example
Example: select elements of an array starting by a certain letter javascript
const countries = ['Norway', 'Sweden', 'Denmark', 'New Zealand'];
const startsWithN = countries.filter((country) => country.startsWith("N"));
console.log(startsWithN);
// Output: [ 'Norway', 'New Zealand' ]