Function to check if a numbers sequence is increasing I need to write a function that takes in a sequence of numbers and returns true if the sequence is increasing or false if it's not:

function isIncreasingSequence(numbers) {
  /**Check if numbers sequence is increasing
  * @param {number} numbers - a sequence of input numbers;
  * @return {boolean} - true if given sequence is increasing, false othrewise
  */
  let numArr = Array.prototype.slice.call(arguments);
  let truthArray = [];

  for (var num = 0; num &lt; numArr.length; num++) {
    while (numArr[num + 1] !== undefined) {
      if (numArr[num] &lt; numArr[num + 1]) {
        truthArray.push(true);
      } else {
        truthArray.push(false);
      }
      num++
    }
  }

  if (truthArray.includes(false)) {
    return false;
  } else {
    return true;
  }
}


Some samples:

console.log(isIncreasingSequence(1,2,3,4)); //true
console.log(isIncreasingSequence(1,255,53,0)); //false
console.log(isIncreasingSequence(0, 0.2, 0.3, 1)); //true


I don't like this while loop nested inside of a for loop. Is there a better way to handle it?
Implementation


The current return statement has the form if(condition) return !condition; else return condition;. This can be simplified to return !condition, i.e. return !truthArray.includes(false);.
The current implementation uses \$O(n^2)\$ runtime and memory, even though it is possible with \$O(n)\$ runtime and \$O(1)\$ memory:


The while loop can be exchanged for an if condition, or dropped entirely if there are no expected undefined entries in the input array (in that case, also remove the superfluous num++) by changing the for loops condition to num &lt; numArr.length - 1.
There is no need to push every partial result into an array: If there is a mismatch, just return false. If there is no mismatch (i.e. you reach the end of the function), simply return true.

The current implementation returns false for input 1, 2, 2, 3. Is this intended?


Cleaned up code

/**Check if numbers sequence is increasing
* @param {number} numbers - a sequence of input numbers, must be valid floating point values;
* @return {boolean} - true if given sequence is increasing, false otherwise
*/
function isIncreasingSequence(numbers) {
  let numArr = Array.prototype.slice.call(arguments);

  for (var num = 0; num &lt; numArr.length - 1; num++) {
      if (numArr[num] &gt;= numArr[num + 1] || Number.isNaN(numArr[num]) || Number.isNaN(numArr[num + 1])) {
          return false;
      }
  }

  return true;
}



  The condition numArr[num] &gt;= numArr[num + 1] || Number.isNaN(numArr[num]) || Number.isNaN(numArr[num + 1]) could be reduced to !(numArr[num] &lt; numArr[num + 1]), but I chose the current condition because it makes the handling of NaN values more visible.
  
  NOTE: Arguments are not validated, call this function with non-Number arguments at your own risk!