title: Converting from nested functions into a chained functions
body: <p>I'm trying to convert this code I wrote into chained functions since I thought it would look cleaner.</p>
  
  <pre><code>let z =this.parkinglot.filter(val=&gt;{
             let propArr =  Object.entries(val.spaces);
             let pass = propArr.some(w=&gt;{
                  let [key,value] = w;
                  return (value &gt; 0);
                  })   
              return (pass===true); 
            })
  </code></pre>
  
  <p>My data structure is an array of objects that looks like this (Stored in an array called this.parkinglot)
  <a href="https://i.stack.imgur.com/ScrAE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ScrAE.png" alt="enter image description here"></a></p>
  
  <p>When I attempt to rewrite this as chained function, I run into the problem of giving the proper input to my functions. Since I need the inner data I needed to use a map but now I have an 3 Layered Array.</p>
  
  <p>Then I ran into the problem of how would I then give this data to filter properly.</p>
  
  <pre><code>let t = this.parkinglot.map(val =&gt; Object.entries(val.spaces))
    .some(w=&gt;{
      console.log('aa',w);
        // let [key,value]=w
         //return (value &gt; 0);
    })
    //.filter(z=&gt;z&gt;1)
  </code></pre>