title: Search an Array made of integers in Javascript and return new array with values
body: <p>I'm trying to make a new array from an if conditional inside a for loop in JavaScript. So far the new array returns undefined when:</p>
  
  <pre><code>if( numbers[i] &lt;= num)
  </code></pre>
  
  <p>I need to return all elements that are less or equal to the value of num and create a new array from them. Can someone tell me what I'm doing wrong?</p>
  
  <pre><code>function search(num, numbers) {
    for (i = 0; i &lt; numbers.length; i++){
    var x = [];
  
      if( numbers[i] &lt;= num){
      x.push(numbers[i]);}
    }
   return x;
   }
  
  (search(14, [7, 3, 23, 9, 14, 20, 7])
  </code></pre>