title: Javascript filter and map where value for a key is true
body: <p>So this is the original code....</p>
  
  <pre><code>selectedProducts = {
    10529814:false,
    10813521:true
  };
  
  this.selectedProducts.forEach((selected, value) =&gt; {
    if(selected) {
      this.discussionMessage.productIds.push(value);
    }
  });
  </code></pre>
  
  <p>I wanted to rewrite it using filter/map technique, this is what I have up to now.</p>
  
  <pre><code>this.discussionMessage.productIds = this.selectedProducts.filter((selected, value) =&gt; selected)
    .map((product) =&gt; product);
  </code></pre>
  
  <p>But no matter what I change I can't seem to end up with a list of just the product ID's where its matched value is true.</p>