on-internet
← Community

How many bytes in a JavaScript string?

Stack Overflow ·

I have a javascript string which is about 500K when being sent from the server in UTF-8. How can I tell its size in JavaScript? I know that JavaScript uses UCS-2, so does that mean 2 bytes per character. However, does it depend on the JavaScript implementation? Or on the page encoding or maybe content-type?

Comments

Sign in or sign up to comment and upvote.

No comments yet.