Search
 
SCRIPT & CODE EXAMPLE
 

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

PREVIOUS NEXT
Code Example
Javascript :: how to detect which key is pressed in javascript 
Javascript :: search class regex 
Javascript :: js date dd.mm.yyyy 
Javascript :: how to loop through date range in javascript 
Javascript :: how to install mongodb in node js 
Javascript :: how to find closest img tag in jquery 
Javascript :: regex contains string in end 
Javascript :: javascript colorized console.log 
Javascript :: javascript convert in a string the items of an array 
Javascript :: download canvas js 
Javascript :: Shuffle a Sting in JavaScript 
Javascript :: update node mac to specific version 
Javascript :: array.filter async 
Javascript :: dice roller javascript 
Javascript :: what is data node in big data 
Javascript :: sort javascript array 
Javascript :: object in array javascript 
Javascript :: string to ascii code js 
Javascript :: How to get tailwindcss intellisense to work with react files 
Javascript :: TypeError: (0 , T.useState) is not a function 
Javascript :: js form serialize 
Javascript :: get screen resolution jquery 
Javascript :: react scroll reset in component 
Javascript :: javascript e.key 
Javascript :: remove first row from table jquery 
Javascript :: javascript convert number to string with 2 decimal places 
Javascript :: javascript push array into array 
Javascript :: how to get datetime javascript now 
Javascript :: using aria attributes in angular 
Javascript :: nodejs fetch 
ADD CONTENT
Topic
Content
Source link
Name
7+9 =