Something went wrong. Try again.
Measure the width of text in the terminal and build simple layouts!
Something went wrong. Try again.
354 B · 14 lines
JavaScript
at main
123456789101112131415const str = "The quick brown fox jumps over the lazy dog.\n".repeat(100)
function fold_parts(str, sep, state, fun) { for (const part of str.split(sep)) { state = fun(state, part) } return state}
let sum = 0for(let i = 0; i < 1000000; ++i) { sum += fold_parts(str, '\n', 0, (acc, line) => acc + line.length)}console.log(sum)