Answers for "Array of range"

14

linux install node

sudo apt install nodejs
Posted by: Guest on April-28-2020
1

generate array range

for (i of range(1, 5)) {
    console.log(i);
}
/* Output
 * 1 2 3 4 5 */

[...range(1, 5)] // [1, 2, 3, 4, 5]
Posted by: Guest on July-06-2020
0

array of range of numbers

k=5
console.log(
   Array.from({length:5},(v,k)=>k+1)
)
Posted by: Guest on March-25-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language