title: Replace null value with a string in an array which is a JSON output - V2.0
body: <p>I was trying to replace the null value that I get through a JSON after submitting a form by a String value like 'n/a' or 'not specified'. I have added few lines as @Winter Solider suggested which is commented below to check null value and replace it but the code I added doesn't work. And idea?<br />
  -thanks</p>
  <pre><code>function submitFormFunction() {
    //document.getElementById(&quot;form&quot;).submit();
    var valueArray = [
      {
        'label': 'contractId',
        'value': document.getElementById('ContractId').value
      },
      {
        'label': 'title',
        'value': document.getElementById('ContractTitle').value
      },
      {
        'label': 'minYear',
        'value': document.getElementById('MinYear').value
      },
      {
        'label': 'maxYear',
        'value': document.getElementById('MaxYear').value
      },
      {
        'label': 'terminal',
        'value': document.getElementById('Terminal').value
      },
      {
        'label': 'location',
        'value': document.getElementById('Location').value
      },
      {
        'label': 'theme',
        'value': document.getElementById('Theme').value
      },
      {
        'label': 'construction',
        'value': document.getElementById('Construction').value
      },
      {
        'label': 'asBuilt',
        'value': document.getElementById('AsBuilt').value
      }
    ].map(function (param) { return param.label + '=' + param.value; });
          
    if (valueArray.length) {
      // here I am trying to handle the null value issue as suggested by Winter Soldier 
      for (var i = 0; i &lt; valueArray.length; i++) {
        if (valueArray[i].includes(&quot;null&quot;)) {
          valueArray[i] = valueArray[i].replace(&quot;null&quot;, &quot;n/a&quot;);
        }
      }
    
      console.log(valueArray)
      console.log(valueArray.join('&amp;'));
      //var queryStr = JSON.stringify(valueArray.replacer);
      var queryString = valueArray.join('&amp;');
      fetch(searchUrl, '?' + queryString, function (data) {
        // output search results to the dom
        renderSearchResults(JSON.parse(data), document.getElementById('searchResults'));
      });
    } else {
        document.getElementById('searchResults').innerHTML = &quot;Please enter a search term.&quot;;
    }
  }
  </code></pre>