Another very simple approach using Buffer
(only for NodeJS):
Buffer.byteLength(string, 'utf8')Buffer.from(string).length
Another very simple approach using Buffer
(only for NodeJS):
Buffer.byteLength(string, 'utf8')Buffer.from(string).length