Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

find the max length of string elements in an array

// find the max length of string elements in an array
arr = ['1', '12', '123'];
max = Math.max(...arr.map(element => element.length));
// returns 3, the length of the string '123'
 
PREVIOUS NEXT
Tagged: #find #max #length #string #elements #array
ADD COMMENT
Topic
Name
2+3 =