Javascript String data type represents a sequence of zero or more 16-bit Unicode characters.
Strings can be delineated by either double quotes ", single quotes ', or backticks `.
let firstName = "css"; let lastName = 'html'; let lastName = `long string`
A string beginning with a certain character must end with the same character.
For example, the following will cause a syntax error:
let firstName = 'css"; // syntax error - quotes must match
String methods charAt, charCodeAt, fromCharCode, toLowercase and toUpperCase.
let s = "ZEBRA"; let s2 = "AbCdEfG"; console.log( "Character at index 0 in '" + s + "' is " + s.charAt( 0 ) ); console.log( "Character code at index 0 in '" + s + "' is " + s.charCodeAt( 0 ) ); //from w ww.j av a2 s. c o m console.log( String.fromCharCode( 87, 79, 82, 68 ) + "' contains character codes 87, 79, 82 and 68" ) console.log( s2 + " in lowercase is '" + s2.toLowerCase() + "'" ); console.log( s2 + "' in uppercase is '" + s2.toUpperCase() );