How to find the longest string size of an array of strings in Node.js

1 Answer

0 votes
const strings = ["c++", "python", "c#", "node.js", "swift", "java"];

const longestStringSize = Math.max(...(strings.map(el => el.length)));
 
console.log(longestStringSize);



/*
run:

7

*/
 

 



answered Oct 2, 2024 by avibootz
...