2 Replies Latest reply: Jun 22, 2010 7:27 AM by 843789 RSS

    Array Question

    843789
      Hi guys,

      Is it possible to do the following thing with arrays:

      Let's say we have 3 elements in array1 (2, 4, 5). Now what i am trying to do is, Math.pow all the elements in array1 and save it in array2. So i just wrote:

      Math.pow(array1[0], 2);
      Math.pow(array1[1], 2);
      Math.pow(array1[2], 2);

      and then tried to: array1[] = array2[];

      Whenever i print out array2[] i get this output: 2, 4, 5. What i want to get in array2 are the elements of array1 in power of 2.

      Please advice.