How to Get a Substring from a string in JavaScript ?

Below is a sample code snippet demonstrating how to get a substring or extract a string from a string in JavaScript.

How to Get a Substring from a string in JavaScript ?

<string>
  var input = "Ginktage Blog";
  var output = input.substring(0, 7);
</string>

The output of the above substring method call will be Ginktage.