SO - 29091902

by Arun P Johny

JavaScript

var from = new Date(2015, 0, 1);
    var to = new Date(2015, 0, 10);
    while (from <= to) {
        console.log(from.getDate());
    
        //this should be last in the loop
        //from = new Date(from.setDate(from.getDate() + 1));
        from.setDate(from.getDate() + 1)
    }