Write a function named rangeOfNumbers
that accepts two integers as parameters and prints the sequence of
numbers between the two parameters, separated by commas and spaces.
Print an increasing sequence if the first argument is smaller than the second; otherwise, print a decreasing sequence.
If the two numbers are the same, that number should be printed by itself.
For example, the call rangeOfNumbers(2, 8)
should produce the following console output:
2, 3, 4, 5, 6, 7, 8
Your function should also be able to count downward if the end is less than the start.
For example, the call rangeOfNumbers(18, 11)
should produce the following console output:
18, 17, 16, 15, 14, 13, 12, 11
If the two values are the same, simply print that number a single time. You may assume that the two parameters passed are
integers. Use console.log()
to print your result on a single line.