181 B
181 B
byteSize
Returns the length of string.
const byteSize = (str) => {
return new Blob([str]).size;
}
byteSize("😀"); // 4
byteSize("Hello World"); // 11
Returns the length of string.
const byteSize = (str) => {
return new Blob([str]).size;
}
byteSize("😀"); // 4
byteSize("Hello World"); // 11