how to get those values and push them in to array using loop

Discussion in 'JavaScript' started by val75, Dec 23, 2008.

  1. #1
    Hi.
    I'm very new with programming, and I struggle with a part of script
    How can I get those values and push them in to array using loop???
    <script>
    var a = prompt("a");
    var b = prompt("b");
    var c = prompt("c");

    var arr=new Array(3);
    arr[0]=a;
    arr[1]=b;
    arr[2]=c;
    <script>
    Thanx
     
    val75, Dec 23, 2008 IP
  2. val75

    val75 Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    var arr=new Array(3);
    for(i=0;i<3;i++){
    arr=prompt("get "+i);
    }
    document.write(arr);
     
    val75, Dec 23, 2008 IP