JavaScript strings

Strings can either be wrapped in " or ' characters. The following are the valid escape characters:

  • \" double quote

  • \' single quote

  • \\ backslash

  • \/ slash

  • \b backspace

  • \f formfeed

  • \n new line

  • \r carriage return

  • \t tab

  • \uxxxx where x can be any hex digit


\u allows you to specify a character numerically. e.g '\u0065' = 'e'

Comments

Popular Posts