Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

js array find string element with max length

// 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 :: regex for mobile number 
Javascript :: get result and write to file node 
Javascript :: check if string matches regex js 
Javascript :: vue js cdn link 
Javascript :: javascript string change character at index 
Javascript :: npm redux toolkit 
Javascript :: How to create react app with yarn, npx or npm 
Javascript :: jquery remove option from dropdown 
Javascript :: prototype pollution 
Javascript :: how to get json data from json file in node js 
Javascript :: react multiple event handlers] 
Javascript :: remove key from object array javascript 
Javascript :: javascript count instances in string 
Javascript :: javascript dice throw 
Javascript :: vue shorthand 
Javascript :: get cursor position in contenteditable div 
Javascript :: object exists in array javascript 
Javascript :: replace spaces with backslash js 
Javascript :: if checkbox is checked open modal popup 
Javascript :: dart list files in directory 
Javascript :: dropzone on success all files 
Javascript :: bootstrap prevent dropdown from closing on click 
Javascript :: js listen for class change event 
Javascript :: Vue use props in style 
Javascript :: To append dropdown option using jquery 
Javascript :: jquery see if checkbox is checked 
Javascript :: moment js react 
Javascript :: replace line break with html line break js 
Javascript :: jquery select attribute 
Javascript :: readonly vs disabled 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =