title: Map and Filter mapped array in Javascript
body: <p>This a very simple question. I want to map and form an array given another array. then I would like to remove the duplicated values.</p>
  
  <p>this is what I did: </p>
  
  <pre><code>let status = listHotels.map(hotel =&gt; {
    return hotel.status
  })
  
  const x = status.filter((v, i) =&gt; (
    status.indexOf(v) === i
  ));
  </code></pre>
  
  <p>It works. But I would like a solution that doesn't involve writing two blocks of code. I tried this: </p>
  
  <pre><code>let status = listHotels.map(hotel =&gt; {
    return hotel.status
  }).filter((v, i) =&gt; (
    status.indexOf(v) === i
  ));
  </code></pre>
  
  <p>But it didnt work. It says </p>
  
  <blockquote>
    <p>Cannot read property 'indexOf' of undefined</p>
  </blockquote>
  
  <p>Does anyone know a workaround this?</p>