Question

  1. Get date.
  2. declare new array
  3. small loop for test.
  4. store my initial date to index 0.
  5. alert to confirm function is working and the value is ok.
  6. the function that adds some constant days to generate new date (working fine).
  7. loop end.
  8. Shows all values in the last date I generate, like replace all array element with last values.

             fx=$("#start_date").val();          
                var list = new Array();             
    
                for (i=0;i<3;i++){                
                list[i]=fx;                       
                alert(list[i]);                          
                fx=calc(fx,dayinfo);                
                }
    
                alert(list);    
    
Was it helpful?

Solution 2

fx=$("#start_date").val();
var list = new Array();

        for (i=0;i<3;i++){                
        list[i]=new Date(fx);                       

        fx=calc(fx,dayinfo);                
        }
    -

        alert(list);    

OTHER TIPS

for (i=0;i<3;i++){
function(i){
   list[i]=fx; 
   alert(list[i]);
   fx=calc(fx,dayinfo);
}(i)
}

try this

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top