Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Are strings arrays of characters?

As there is no character data type in JavaScript, what are strings?
Are strings in JavaScript arrays of characters? If strings are not arrays of characters then what are they?

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Strings are not arrays:

console.log(Array.isArray("some string"));

However, they are "array-like objects", and they support the subscript ([]) operator. Note that the subscript of a string is a string on its own right – as you noted, there is no "char" type in JavaScript:

console.log(typeof "some string"[0]);
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading