How to extract words with specific length from array to new array in JavaScript

1 Answer

0 votes
const array = ['javascript', 'c++', 'c#', 'php', 'python', 'sql'];

const result = array.filter(word => word.length == 3);

console.log(result);



  
    
    
/*
run:
    
["c++", "php", "sql"]
    
*/

 



answered Nov 30, 2020 by avibootz
...