Results 1 to 3 of 3

Thread: push()

  1. #1

    Thread Starter
    Fanatic Member merhaba's Avatar
    Join Date
    Sep 2002
    Location
    Istanbul,Bartin-Gallipoli(Gelibolu-Canakkale)
    Posts
    601

    push()

    I tried to add more names to the array but....
    VB Code:
    1. <script language="JavaScript">
    2.  var names=new Array("Tom", "Dan", "Liz", "Jody");
    3.  document.write("<b>Original array: "+ names + "<br>");
    4. for (x=1;x<=5;x++)
    5. {
    6. var isim=prompt("....","....")+x;
    7. }
    8.  names.push(isim(x));
    9. document.write("New array: "+ names + "</b>");
    10. </script>

  2. #2
    Frenzied Member
    Join Date
    Jun 2005
    Posts
    1,170

    Re: push()

    But que?

  3. #3
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: push()

    But you put the push outside the loop, use () instead of [] for array indexing, and try to use as an array what isn't. Not to mention that you have scoping problems.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width