Defining Special Characters as Variables for Later Use : Char « Language Basics « JavaScript DHTML






Defining Special Characters as Variables for Later Use

/*
Symbol                Description

\t                    Tab
\n                    Newline
\r                    Carriage return
\f                    Form feed
\\                    Backslash
\b                    Backspace
\"                    Double quote
\'                    Single quote

*/

<script type="text/javascript">
<!--
  // Inline Character Constants
  var TAB = "\t";
  var CR = "\r";
  var LF = "\n";
  var CRLF = "\r\n";
  var FF = "\f";
  var DQUOTE = '\"';
  var SQUOTE = "\'";
  var BACKSLASH = "\\";
  var BACKSPACE = "\b";
   
  document.write("Column1" + TAB + "Column2" + TAB + "Column3")
//-->
</script>


           
       








Related examples in the same category

1.Displaying a String Containing Escaped Quotations
2.Using Special Characters in JavaScript
3.Using Special Formatting Characters
4.Character Conversions