JavaScript String Formating Style Example

Example

<!DOCTYPE html>
<html lang="en">
<head>
  <title>JavaScript string function</title>
</head>
<body>
  <script type="text/javascript">
    var str = "Hello String!";
    document.write("<p> Bold: " + str.bold() + "</p>");
    document.write("<p> Italic: " + str.italics() + "</p>");
    document.write("<p> Big: " + str.big() + "</p>");
    document.write("<p> Small: " + str.small() + "</p>");
    document.write("<p> Strike: " + str.strike() + "</p>");
    document.write("<p> Fontsize: " + str.fontsize(4) + "</p>");
    document.write("<p> Fontcolor: " + str.fontcolor("orange") + "</p>");
    document.write("<p> Link:"+str.link("http://Way2Tutorial.com")+"</p>");
    document.write("<p> Subscript: " + str.sub() + "</p>");
    document.write("<p> Superscript: " + str.sup() + "</p>");
  </script>
</body>
</html>

Run it...   »

Example Result