3 ms·
Why not just do it with an object of letter -> width key/pairs? then... fontWidth(word) { return sum(map(word.split(''), function (l) letterWidth[l
by andreyf 18y ago
Why not just do it with an object of letter -> width key/pairs? then...
fontWidth(word) {
return sum(map(word.split(''), function (l) letterWidth[l]));
}
I bet it would be faster in firefox.