I want to create a function that takes input from user and returns an array with all the numbers from 1 to the passed number as an argument. Example: createArray(10) should return [1,2,3,4,5,6,7,8,9,10]. I came up with this solution:
function createArray(input) { var value = 0; var array = []; for (i=0;i<input;i++) { value++; array.push(value) console.log(array) } } createArray(12); What is the correct and better way of doing it?