One LinerCreate array from 1 to nCreate array from 1 to nJavascriptTypescriptconst generateArray = (n) => Array.from({length: n}, (_, i) => i + 1) Example generateArray(10); // [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]Last Update: 15:54 - 09 April 2024PreviousCreate 2D arrayNextCreate array of n elementsOn this page