mengembalikan string terpanjang dari array
arr.reduce((a, b)=> a.length > b.length ? a : b);
Shirshak kandel
arr.reduce((a, b)=> a.length > b.length ? a : b);
function data(str){
var show = str.split(" ");
show.sort(function (a,b){
return b.length - a.length;
})
return show[0];
}
console.log(data(str = "javascript is my favourite language "));
Math.max(...(x.map(el => el.length)));