在给定html字符串和给定宽度的情况下,如何实现一个高效的wordwrap方法?
如
var html = `
The word-break CSS property specifies whether or not the browser should insert line breaks wherever the text would otherwise overflow its content box.
var width = 624;
var result = wordwarp(html, width);
console.log(result);
/*
The word-break CSS property specifies whether or not the browser should
insert line breaks wherever the text would otherwise overflow its content box.
*/