Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Given the following JavaScript code: <script language=javascript type=\"text/jav

ID: 3851461 • Letter: G

Question

Given the following JavaScript code:

<script language=javascript type="text/javascript">

                for (i=0;i < 10; i++) {

          document.write(i);

         }

    </script>

1.How would you modify the code so that it prints the numbers backwards? Please list your codes.

2.How would you modify the code so that it prints only the even numbers? Please list your codes.

3. How would you modify the code so that it sums all the values of i and prints the final sum? Please list your codes.

Explanation / Answer

2. you should try something like this