Skip to content

Latest commit

 

History

History
24 lines (19 loc) · 733 Bytes

byteSize.md

File metadata and controls

24 lines (19 loc) · 733 Bytes
title tags author_title author_url author_image_url description image
byteSize
string,beginner
Deepak Vishwakarma
Implementation of "byteSize" in typescript, javascript and deno.

JS

Returns the length of a string in bytes.

Convert a given string to a Blob Object and find its size.

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