title: How create a loop of expression and logical operators by loop - javaScript?
body: <p>If I have An array of value and I want to create logical operators while I do a loop over these values</p>
  <pre><code>const values = [{from: 2, to: 8}, {from: 11, to:20} ..... ]
  </code></pre>
  <p>to get a result like this</p>
  <pre><code>return (8 &gt; 2) || (20 &gt; 11) || .......
  </code></pre>
  <p>How I can do this with javascript if I want to create something complex like</p>
  <pre><code>   const time = [{ from: '2021-07-30', to: '2021-07-20' }, { from: '2021-07-05', to: '2021-07-02' }, ......]
      const disableDates = (date) =&gt; {
  
          time.forEach(element =&gt; {
              return (moment(date).isSameOrBefore('2021-07-30') &amp;&amp; moment(date).isSameOrAfter('2021-07-20')) || (moment(date).isSameOrBefore('2021-08-05') &amp;&amp; moment(date).isSameOrAfter('2021-08-02')) || .....
  
          });
  
      }
  </code></pre>
  <p>I want to create this line</p>
  <pre><code>return (moment(date).isSameOrBefore('2021-07-30') &amp;&amp; moment(date).isSameOrAfter('2021-07-20')) || (moment(date).isSameOrBefore('2021-08-05') &amp;&amp; moment(date).isSameOrAfter('2021-08-02')) || .....
  </code></pre>