For point 1 I would use "reduce":
lines.reduce((longest, line) => (longest.length > line.length) ? longest : line, "")
https://developer.mozilla.org/en/docs/Web/JavaScript/Referen...EDIT: sorry, initial code returned length, not line itself