Answers for "select elements of an array starting by a certain letter javascript"

0

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' ]
Posted by: Guest on October-15-2020

Code answers related to "select elements of an array starting by a certain letter javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language