Day 13 of #100daysofjs

Day 13 of #100daysofjs

STRINGS

Strings are used to store and manipulate text.

Strings can be created using the following syntax.

Let name = "Arpan" - Creates a string
name length - This property print length of the string

Strings can also be created using single quotes

Let name = 'Arpan'

Template Literals

Template Literals use backticks instead of quotes to define the strings

Let name = `Arpan`

With template literals, it is possible to use both single as well as double quotes inside a string.

we can insert variables directly in the template literal this is called a string interpolation

let boy1 = "Heisenberg"
let boy2 = "Bruce Wayne"
//Bruce Wayne is a friend of Heisenberg
let sentence = `${boy2} is a friend of ${boy1}`

Escape Sequence Characters

In JavaScript, escape sequences are special characters that are used to represent certain characters that are difficult or impossible to type directly. Escape sequences start with a backslash () followed by a specific character or combination of characters. Here are some commonly used escape sequences in JavaScript:

  1. \n: Represents a newline character.

  2. \r: Represents a carriage return character.

  3. \t: Represents a tab character.

  4. \": Represents a double quotation mark character.

  5. \': Represents a single quotation mark character.