Create an i element from string object in JavaScript

Description

The following code shows how to create an i element from string object.

Example


<!DOCTYPE html>
<html>
<body>
<script type="text/javascript">
var myString = new String();<!--  w w  w .j  av a2 s .co m-->
myString = "red";
document.writeln(myString.italics());


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

Click to view the demo

The code above generates the following result.

Create an i element from string object in JavaScript