title: how to set array in URL query param
body: <p>I have multi-checkbox inputs. if checked, I want set query params like this:</p>
  <p>topic[]=1&amp;topic[]=2&amp;...</p>
  <p>please help me resolve this problem</p>
  <p>this is my code for unique param:</p>
  <pre><code>const addQueryParam = (name, value) =&gt; {
    const urlParam = new URL(window.location.href);
    if (!value) {
      urlParam.searchParams.delete(name);
    } else {
      urlParam.searchParams.set(name, value);
    }
    window.history.pushState({ path: urlParam.href }, &quot;&quot;, urlParam.href);
  };
  
  </code></pre>