How to find the longest string size of an array of strings in JavaScript

1 Answer

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

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



/*
run:

10

*/

 



answered Oct 2, 2024 by avibootz

Related questions

...