Creating Strings

There are two ways to create a string in Javascript:

  • Using string literal
  • Using string object

String in JavaScript

String is used to representing the sequence of characters. They are made up of a list of characters, which is essentially just an “array of characters”. It can hold the data and manipulate the data which can be represented in the text form. We can perform different operations on strings like checking their length, also concatenate them by using +=, +, string operators.

Similar Reads

Creating Strings:

There are two ways to create a string in Javascript:...

Method 1: Using string literal

A string can be created just by initializing with a string literal. There are three ways to write a string literal:...

Method 2: Using string object

...

Character Access:

A string can also be created using a String object....

Method 1: Using charAt() Method

...

Method 2: String as an array-like object

A character can be accessed from a string in one of two ways....

Contact Us