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.

If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.

Leave a Reply