javescript help needed please help!!!!!


Can anyone help me with this javascript please
as you can see i have given it a far shot but just not getting the end result.
but i need it to list the outcome each time i click enter in a window like this

Iterations taken: 4

any help would be great as i am getting tired now after a week of trying

thank you


Ducci's Game

//Write your functions here.
function difference() {

//Main program.
//Array which holds the numbers at the four corners of the square.
var numberArray = [16,14,4,5];//Edit this line to change the starting numbers
document.write(numberArray +'
');//Write out array.

//Write the rest of the main program here.
var numberArray = [16,14,4,5];
var diffArray = new Array(4);
var count = 0;
var numLen = numberArray.length;
for (count = 0; count < numLen; count++) {
if ((count + 1) == numLen) {
diffArray[count] = numberArray[count] - numberArray[0];
alert("a " +numberArray[count] + " - " + numberArray[0] + " = " + diffArray[count]);
} else {
diffArray[count] = numberArray[count] - numberArray[count + 1];
alert("b " + numberArray[count] + " - " + numberArray[count + 1] + " = " + diffArray[count]);



  • I'm doing the M150 course for the open uni and this IS on the TMA that we are doing at the moment. The cut off date for it is March 2nd so people still have time in which to hand it in to be marked. Its the same variables, same date, same names on the arrays, same comments etc. The only good thing is the people that have done the code so far have used codes that we have not yet been introduced to and it clearly states in the TMA that we are only allowed to use the code in the books.

    I'm stuck myself but that doesn't mean that I want people to do it for me. I'm just looking for a better idea on how arrays work in a loop. I just find it very dissapointing that people would come on here to get others to do their work for them when other people have to work for their degree.
  • oi dickwad

    how am i asking for someone to do it for me ?
    as you can plainly see i have done it already and and not once have i asked for someone to do it for me.
    so unless you have something constructive to say would you please stay out of my business.
    thank you
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!