Files
30-seconds-of-code/snippets/byteSize.md
2017-12-29 23:37:58 +11:00

166 B

byteSize

Returns the length of string.

const byteSize = str => new Blob([str]).size;
byteSize("😀"); // 4
byteSize("Hello World"); // 11