hi all have a homework project have to come up with a html code for ducci's 4 number game using a fuction called difference(firstNumber secondNumber) can anyone help if i get this wrong i am in serious trouble please help

## All 10 Replies

Its not learning if your making someone else do it

i dont want the answer i just need a little shoov in the right direction

Its not learning if your making someone else do it

i only need a shoov in the right direction can you help

you start, we steer - once you begin
There are announcements above all the forums about homework
show a code example, and many will help straight off, otherwise you just get answers like this

<script>
var numberArray = [16,14,4,5];
var diffArray = new Array(4);
function difference(firstNumber, secondNumber,)
{
var firstNumber = numberArray.lenght;
var secondNumber = numberArray.lenght;
{
for (var count = 0; count < numberArray.length; count = count + 1)
{
diffArray[count] = firstNumber[count] - secondNumber[count + 1];
}

for (var count = 0; count < diffArray.length; count = numberArray + 1)
{
if (firstNumber > secondNumber)
{
firstNumber - secondNumber;
}
else
{
secondNumber - firstNumber;
}
}
{
document.write(difference() + ',');
}
}}
</SCRIPT>

Your code is full of syntax errors. I think this is what you want. But, you really need to learn this stuff on your own.

``````<script>
difference();
function difference() {
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]);
}
}
}
</script>``````

You can't use this for your answer on TMA03 question 4 of the m150open uni course as it is using java that is not in the books yet!

im not at uni im only 15 still at school my teachures say i dont have the brains to go to uni

im not at uni im only 15 still at school my teachures say i dont have the brains to go to uni

Your using the same values as the question and the same function names. I'm not stupid so don't take me for a fool! Oh and in the other forum you are even showing the java with the same comments on it and date!

you can use html input object,

hi all have a homework project have to come up with a html code for ducci's 4 number game using a fuction called difference(firstNumber secondNumber) can anyone help if i get this wrong i am in serious trouble please help

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.