Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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' ]
Comment

PREVIOUS NEXT
Code Example
Javascript :: mongodb replace string regex 
Javascript :: localstorage try catch 
Javascript :: largest sum contiguous subarray javascript 
Javascript :: header disallowed by preflight response in express 
Javascript :: Mars Exploration problem in js 
Javascript :: javasript document referrer 
Javascript :: include js to js 
Javascript :: parse time in javascript 
Javascript :: react render component after data loaded 
Javascript :: npm is not recognized 
Javascript :: pass parameter to handleclick react 
Javascript :: copy to clipboard jquery example 
Javascript :: node js run for loop asynchronously 
Javascript :: vue mapgetters with parameter 
Javascript :: char array to string javascript 
Javascript :: link to another page and achor react 
Javascript :: nodejs base64 
Javascript :: polyfill of bind 
Javascript :: javascript regex Zero or one occurrence 
Javascript :: convert Float64Array to array in js 
Javascript :: jquery selector parent on hover 
Javascript :: how to delete duplicate elements in an array in javascript 
Javascript :: move first element to last javascript 
Javascript :: js increment and decrement function for cart 
Javascript :: swap two variables javascript 
Javascript :: generate random color 
Javascript :: es6 convert array to object 
Javascript :: get url query in react 
Javascript :: jquery post form async 
Javascript :: for of loop js 
ADD CONTENT
Topic
Content
Source link
Name
1+6 =