[Code Parcel]
  • Home
  • Snippets
  • Become a Contributor
  • Find Instagram User ID
  • Login
  • Contact
  • Loggin to your account
Himas Rafeek
Posted on: 3 years ago
Javascript

Javascript byte Size Function

This snippet returns the length of a string in bytes.


                                          const byteSize = str => new Blob([str]).size;

byteSize('😀'); // 4
byteSize('Hello World'); // 11                                          
Views: 12
Favorite0
Subscribe
Login
Notify of
Please login to comment
0 Discussions
Inline Feedbacks
View all comments

Related Snippets

What’s the best way to validate an email address in JavaScript?

Javascript

Prevent users submitting contact form if less than 2 words are entered (JavaScript)

CSS

Javascript Page bottom Visible Function

Javascript

Javascript cast Array Function

Javascript

Javascript capitalize string function

Javascript

Javascript capitalize Every Word

Javascript

Javascript bifurcate Function

Javascript

Javascript bifurcate By Function

Javascript

Javascript average Function

Javascript

Javascript average By Function

Javascript

Javascript attempt Function

Javascript

Javascript array To Html List Function

Javascript

© Reserved [Code Parcel] 2022

Login

Register

Forgotten Password?

Register | Lost your password?
| Back to Login
wpDiscuz