Ad
Arrays

Write a function, onlyOdds that accepts an array of numbers as an argument. It should return a new array that contains only the odd numbers from the given array.

You may assume any array given as an argument will not be empty.

let onlyOdds = input => {
  let newArray = []
  for (let i = 0; i < input.length; i++) {
    let currentElem = input[i]
    if (currentElem % 2 === 1) {
      newArray.push(currentElem)  
    }
  }
  return newArray
}