How add space after each characters in jQuery

As we know that the split() method is used to split a string into an array. If you pass empty string in split method then it split each chrachter into an array. After that we do a for loop in array and add a space in each item and store the vlaue in a new variable.
<!DOCTYPE html>
  <title>jQuery With Example</title>
  <script src="" type="text/javascript"></script>
  <script type="text/javascript">
    $(function () {
      $('.btnClick').click(function () {
        var cName = "INDIA";
        var cArray = cName.split("");
        var cNewName = "";

        for (var i = 0; i < cArray.length; i++) {
          cNewName += cArray[i] + " ";


    <input type="button" class="btnClick Button" value="Click" />

No comments :

Please Give Your Feedback