Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

return longest string from array

arr.reduce((a, b)=> a.length > b.length ? a : b);
Comment

all longest strings javascript

function solution(inputArray) {
    return inputArray.reduce((r, s, i) => {
        if (!i || r[0].length < s.length) {
            return [s];
        }
        if (r[0].length === s.length) {
            r.push(s);
        }
        return r;
    }, []);
}
Comment

javascript find the longest string in array

Math.max(...(x.map(el => el.length)));
Comment

PREVIOUS NEXT
Code Example
Javascript :: delete all node_modules folders recursively windows 
Javascript :: javascript take first element of array 
Javascript :: This version of CLI is only compatible with Angular versions 0.0.0 || ^9.0.0-beta || =9.0.0 <10.0.0, but Angular version 10.0.14 was found instead. 
Javascript :: calculato 
Javascript :: how many days old am i 
Javascript :: copy text to clipboard javascript without input 
Javascript :: how to make a deep copy in javascript 
Javascript :: delta time js 
Javascript :: element ui handle enter key 
Javascript :: send message whatsapp javascript 
Javascript :: lexical scoping javascript 
Javascript :: touppercase javascript array 
Javascript :: node version check in cmd 
Javascript :: Find all links / pages on a website 
Javascript :: remove array elements javascript 
Javascript :: how to reload the window by click on button in javascript 
Javascript :: json to list flutter 
Javascript :: get random percentage javascript 
Javascript :: .ignore file nodejs 
Javascript :: use onchange with react select 
Javascript :: golang parse jason 
Javascript :: javascript minimum number in array 
Javascript :: axios x-api-key for all 
Javascript :: jquery add multiple classes 
Javascript :: jquery get data attribute 
Javascript :: joi validation compare two password 
Javascript :: javascript average of arguments 
Javascript :: how to use typeof in javascript 
Javascript :: how to take input in javascript in coding 
Javascript :: javascript string contains character 
ADD CONTENT
Topic
Content
Source link
Name
4+9 =