JavaScript String

String is a static text that enclosed via a single or double quote

When you wan to use variable inside string . Then  you need to use string literal (backtick) that comes form ES2015 (ES6)

var str = "Hello"; // use double quote

var myStr = 'Word' // use single quote

var x = 5;

var string = `The number is ${x}`; //string literal or back tick

// The number is 5

String Concatenation

String concatination is used to join two or more than two string and convert into a single string 

String concatination done by the + operator

Example

Note - you can create static string by single quote or double quote 

Tips - When you create string using double quote then you can not use one more double quote inside this string , But you can use single quote

Example

"JavaScript is web programming language isn't system programming language"

String Literal

String literal use to create string with variable data

Example

Tips  -  You can use only single quotes inside string literal

Problem - You can not use double quotes inside the string literal string 

String()  Function

String can be created via string function

string function return passing parameter in form of string

Example

toString() function

The toString function also use to convert number, boolean, null and object into string

Example

formCharCode

String.formCharCode is used to convert character code into string

Example

String.formCharCode(104,101,108,111); // 'Hello'

String Object

create a string object using new keyword is allow , but is not recommended as it behaves like ,object unlike primitive strings

Example