Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript create range with a loop

function createRange(min, max) {
    var range = [];
    for (let i = min; i <= max; i++) {
        range.push(i);
    }
    return range;
}

createRange(1, 5)
// => [1, 2, 3, 4, 5]
Comment

PREVIOUS NEXT
Code Example
Javascript :: js two array combining with id 
Javascript :: javascript open new window with html content 
Javascript :: django jquery 
Javascript :: sort string 2d array in javascript 
Javascript :: nodejs mysql insert query 
Javascript :: jquery window trigger resize 
Javascript :: javascript text word wrap replace 
Javascript :: enter only numbers in input field angular 
Javascript :: js input type range on hover 
Javascript :: how to generate unique id in node js 
Javascript :: js number to scientific notation 
Javascript :: javascript get image width and height 
Javascript :: prevent multiple form submissions javascript 
Javascript :: check if a column is unique sql 
Javascript :: sort object by key value javascript 
Javascript :: javascript string contains function 
Javascript :: boilerplate node js server 
Javascript :: jquery selector exists 
Javascript :: jquery growl cdn 
Javascript :: bcd full form in electronics 
Javascript :: javascript allow only numeric characters 
Javascript :: promise.allsettled polyfill node 
Javascript :: check if string contains character javascript 
Javascript :: chess 
Javascript :: javascript rupiah currency format 
Javascript :: radiojquery 
Javascript :: javascript get value 
Javascript :: flatlist onrefresh react native 
Javascript :: what is reactjs 
Javascript :: window.location.href is not a function 
ADD CONTENT
Topic
Content
Source link
Name
2+6 =