June 22, 2018
function findLongest(array){
return array.reduce((res, curr) => (String(res).length < String(curr).length) ? curr : res);}
function findOutlier(int){
var even = int.filter(a=>a%2==0);
var odd = int.filter(a=>a%2!==0);
return even.length==1? even[0] : odd[0];
}
June 26, 2018
function ordre(words){
return words.split(' ').sort(function(a, b){
return a.match(/\d/) - b.match(/\d/);
}).join(' ');
}
function highAndLow(numbers){
var arr = numbers.split(" ");
return Math.max.apply(null, arr) + " " + Math.min.apply(null, arr);
}