javascript

Get a bigger word from a javascript array

console.log(longestStringReduce(['boop', 'bloomburg', 'hello']));

function longestStringReduce(arr) {
  return arr.reduce((a, b) => a.length < b.length ? b : a, "");
}

//bigger word
//bloomburg

Get a bigger word from a javascript array

Was this helpful?