Including a special character in a string : String « Data Type « JavaScript DHTML






Including a special character in a string

  

<html>
  <head>
    <title>Including a special character in a string</title>
    <script type="text/javascript">
var a = "First line.\nSecond line.";

alert("String with a newline special character: " + a);    
    </script>
  </head>
  <body>
  </body>
</html>

   
    
  








Related examples in the same category

1.Get char at
2.String big
3.String blink
4.Make string bold
5.Create anchor from a string
6.Get char Code
7.Concat String
8.String escape
9.Escape double quote
10.String font Color
11.String font Size()
12.String index Of
13.Combine indexOf and substring methods to get the anchor part of a url
14.Search the string and counts the number of e's
15.String from Char Code
16.String in italics
17.String last Index Of
18.String length
19.Compare string in locale format
20.Make String link
21.Match string
22.String replace
23.Slice a string
24.Get small String
25.Split a string
26.Return strike String
27.String sub() Example
28.Get sub string (substr())
29.Use substring method to get the sub string
30.Get super script (sup)
31.Get Locale Lower Case string (toLocaleLowerCase)
32.Get Locale Upper Case string (toLocaleUpperCase)
33.Get Lower case String (toLowerCase)
34.Get Upper Case string (toUpperCase)
35.'unescape()' Example
36.Check the first letter of a name
37.Use String.indexOf method to validate an email address
38.Validate a time value input with string.indexOf method
39.Return string value from a function
40.Tab string character
41.Adding trim function to String
42.Double quote string character
43.Single quote string character
44.Back slash string character
45.Backspace string character
46.Capitalize Words
47.Count Words