The Unwritten Rules of JavaScript Strings.

To master something.. practice the fundamentals heavily.

Respect the building blocks, master the fundamentals and the potential is unlimited — PJ Ladd

If you are a JavaScript Developer or studying to be one, here are are some small fundamental String reminders.


A string can be any text inside double or single quotes/

  • Are immutable. Once made, cannot be changed. However, you can make a new string by concatenating other strings with the ‘+’ operator.
  • Strings are primitive values. Like Boolean, Number and Null. Strings are values of the String type.
  • There exist String objects which can be used to store string values, but those String objects are not used in practice:
var newString = new String('foo'); // "object"| not used in practice
newString.indexOf('o'); // 1
var newStr = 'foo'; // "string", much used in practice.
newStr.indexOf('o'); // 1

Escape Characters.

A backslash (\) followed by a letter or by a combination of digits.

Commonly used:

  • \n New line.
  • \” Double quote
  • \’ . Single quote
  • \t Tab.
  • \/ Slash.
  • \\ Backslash
Show your support

Clapping shows how much you appreciated Tyrese W.’s story.