JS: String Object

By Xah Lee. Date: . Last updated: .

String is the value of the property key "String" of the global object. [JS: the Global Object]

console.log( window.String === String ); // true


String is a function.

[see JS: Value Types]

// type of String
console.log ( typeof String === "function" ); // true


Parent of String is Function.prototype. [see JS: Prototype and Inheritance]

// parent of String
console.log ( Reflect.getPrototypeOf ( String ) === Function.prototype ); // true


Purpose of String is:

  1. String(value) is used to convert any (primitive or object) value to a string primitive.
  2. new String(value) is used to convert any (primitive or object) value to a string object.
  3. Used as a namespace to hold general purpose methods for working with string or character.
  4. Holds the property key "prototype". The value of String.prototype is the parent object of all string instances and string primitives.

[see JS: Primitive Value]

String Constructor

[see JS: String Constructor]


JS String

  1. String Overview
  2. Template String
  3. Char, Code Unit, Codepoint
  4. String Escape Sequence
  5. Unicode Escape Sequence

JS RegExp

  1. RegExp Tutorial
  2. RegExp Syntax
  3. Regex Find/Replace

Like it? Help me by telling your friends. Or, Put $5 at patreon.

Or, Buy JavaScript in Depth

If you have a question, put $5 at patreon and message me.

Web Dev Tutorials

  1. HTML
  2. Visual CSS
  3. JS in Depth
  4. JS Object Ref
  5. DOM Scripting
  6. SVG
  7. Blog