Explore BrainMass

JavaScript - Loops

This content was STOLEN from BrainMass.com - View the original, and get the already-completed solution here!

See the attached files.

I have been working on this all day and am still having trouble with the following:

1) Even should only be reading for the FOR Loop. I tried moving it around and it won't work so I don't know how to fix it to not show on the DO..WHILE Loop and the WHILE Loop.

2) I have to add an Odd next to the odd numbers in ONLY the BACKWARDS FOR Loop.

3) BACKWARDS FOR Loop has to be on a separate page with a link to the Loops.html page.

4) Loops.html page has to have a link to the Backwards Loops.html page

5) Both pages have to be in color

I added what I thought were the codes for all of the above, however, neither one will run. I don't know what I'm doing wrong!!

© BrainMass Inc. brainmass.com October 25, 2018, 1:23 am ad1c9bdddf


Solution Preview

See attachments. Problem in your scripts:

1) You had duplicate BODY tags. This tag can only exist once
2) You were missing a "}". Curly braces should be in matched pairs
3) You had a sting indicated with a single-quote at the beginning and a double-quote at the end. Always use ...

Solution Summary

A working HTML example that includes all three loop times and determining if the numbers are odd or even.

See Also This Related BrainMass Solution

Writing a program using loops in JavaScript

I need to know how to write a program that counts from 1 to 10 and prints each count to the browser using each of the 3 different kinds of loops in JavaScript (FOR, DO--WHILE, and WHILE).

I also need to create a separate page that counts down from 10 to 1.

I am so confused!

View Full Posting Details