Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript String Methods</h1>
<h2>The sub() Method</h2>
<p id="demo1"></p>
<p>The sub() method is deprecated in JavaScript.</p>
<p>Use the sub tag instead:</p>
<p id="demo2"></p>
<script>
let text = "Hello World!";
let result = text.sub();
document.getElementById("demo1").innerHTML = text + " " + result;
result = "<sub>Hello World!</sub>"
document.getElementById("demo2").innerHTML = text + " " + result;
</script>
</body>
</html>