title: Add a "+" before each word in a string using jQuery
body: <p>I have created an array, "outData", using <code>javascript</code>, which looks like this:</p>
  
  <p><a href="https://i.stack.imgur.com/zbHuF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zbHuF.png" alt="outdata array"></a></p>
  
  <p>I'm now trying to: </p>
  
  <ol>
  <li>loop through the outData array using jQuery each;</li>
  <li>if the checkbox called 'bmm' is ticked, split the strings in the outData array into individual words;</li>
  <li>add a "+" sign before each word;</li>
  <li>finally, join the words with the plus signs into new strings (with a space between each word) and push into a new array called "outPlus".</li>
  </ol>
  
  <p>I'm stuck on how to correctly add the plus sign before each word split from the strings.</p>
  
  <p>My code currently looks like this:</p>
  
  <pre><code>$(document).ready(function() {
  
      $("#multi").submit(function(e) {
          e.preventDefault();
          $("#output").empty();
          var array1 = [];
          var array2 = [];
          var array3 = [];
          $(".col1").each(function() {
              var word1 = $(this).val();
              if ( word1 !== "" ) {
                  //word1 = word1.replace(/\s+/g, '');
                  array1.push(word1);
              }
          });
          $(".col2").each(function() {
              var word2 = $(this).val();
              if ( word2 !== "" ) {
                  //word2 = word2.replace(/\s+/g, '');
                  array2.push(word2);
              }
          });
          $(".col3").each(function() {
              var word3 = $(this).val();
              if ( word3 !== "" ) {
                  //word3 = word3.replace(/\s+/g, '');
                  array3.push(word3);
              }
          });
          console.log(array1);
          console.log(array2);
          console.log(array3);
          var outData = [];
          var outPlus = [];
          $(array1).each(function( a, b ) {
              $(array2).each(function ( c, d ) {
                  outData.push( b + " " + d );
                  $(array3).each(function( e, f ) {
                      outData.push( b + " " + d + " " + f );
                  });
              });
          });
  
          console.log(outData);
  
          if ( $("input[name='bmm']").prop("checked") == true ) {
              $(outData).each(function( g, h ) {
                  outPlus.push( h.split(" ") );
              });
  
              console.log(outPlus);
  
              $(outPlus).each(function( i, j ) {
                      var output = j.replace(/(^|\s)/g, '$1+');
                      console.log(j);
                  });
          }
  
          console.log(outPlus); //Uncaught TypeError: j.replace is not a function
      });
  
  });
  </code></pre>
  
  <p>Current output:</p>
  
  <pre><code>Uncaught TypeError: j.replace is not a function
  </code></pre>
  
  <p>Desired output:</p>
  
  <pre><code>+used +car
  +used +car +for +sale
  +used +car +on +sale
  etc...
  </code></pre>
  
  <p>Would be very grateful for help to produce the desired results. Many thanks in advance.</p>