Strings & Characters

In JavaScript there is no data type for a single character.


Data Types


Single or Double Quote

Strings you can use single or double quotes

let string1 = "some ' text";  
let string2 = 'some " text';
let string3 = `some text`;

There is no difference between the single and double quotes.
Backticks were added in ES 2015 to provide another way of writing a string literal.


var combine = "Mon" + "Tue"; 
var v2 = combine[4]; // T - 0 based
var length = combine.length; // 6

There is no multi-line string syntax
new line \n
string literal delimiter \" or \'
unicode characters \u00A9


escape characters \" for double quotes
backslash single quote
backslash double quote


Converting

Converting




© 2019 Better Solutions Limited. All Rights Reserved. © 2019 Better Solutions Limited TopNext