Javascript - String String Type

Introduction

The String type is the object representation for strings and is created using the String constructor:

var stringObject = new String("hello world");

The methods of a String object are available on all string primitives.

valueOf(), toLocaleString(), and toString() of string object return the object's primitive string value.

Each instance of String contains a property, length, which indicates the number of characters in the string.

Demo

var stringValue = "hello world";
console.log(stringValue.length);   //"11"

Result

This example outputs "11", the number of characters in "hello world".