title: In Javascript, how do you add search querys to get requests?
body: <p>My program uses a charity database API to show the user charities based on their search. Currently I have it set up so that users can search via keyword but I would like to allow users to be able to add parameters to narrow their search like state, city, or rating. The problem I am having though is that if I include the possibility of the parameter, and the user leaves it blank, it wont complete the get request. <br></p>
  <pre><code>function fetchData(search, state){
  
  
       let params = {
          app_id: app_id,
          app_key: app_key,
          search: search,
          state: state,
      }
  
  
  
      //this program formats the query paramaters
      let searchQuery = formatQueryParams(params)
  
     
      let searchURL = url + searchQuery;
      
  
      fetch(searchURL)
      .then(response =&gt;response.json() )
      .then(data =&gt; updateDOM(data))
      .catch(err =&gt; {
          console.log(`${err.message}`)
        })
  
  } 
  </code></pre>
  <p>In this case, if the user doesn't add a state, the program would create an error.</p>