Create a font element from string object and set the size in JavaScript

Description

The following code shows how to create a font element from string object and set the size.

Example


<!DOCTYPE html>
<html>
<body>
<script type="text/javascript">
var myString = new String();<!--from  w  w  w.  j  a  va 2s. c  o  m-->
myString = "red";
document.writeln(myString.fontsize(100));


</script>
</body>
</html>

Click to view the demo

The code above generates the following result.

Create a font element from string object and set the size in JavaScript